[Question]DDJ Convert

11/11/2011 21:27 madutz1#1
How i can convert from png or other to ddj ? because i make image in photo shop and cant save .ddj .. if i pui name.ddj and put in media.pk2 ,,, media dont read it and cant open client... any idea?
11/11/2011 21:54 bheaven#2
DDJ can be easily converted to DDS which can be opened in various image editors.

c# snippet:
Code:
        static public byte[] DDJ_to_DDS(byte[] ddjStream)
        {
            byte[] ddsStream = new byte[ddjStream.Length - 20];

            Array.Copy(ddjStream, 20, ddsStream, 0, ddsStream.Length);

            return ddsStream;
        }


        static public byte[] DDS_to_DDJ(byte[] ddsStream)
        {
            byte[] ddjStream = new byte[ddsStream.Length + 20];

            Int32 ddjStreamLen = ddsStream.Length + 8;

            byte[] header1 = {0x4A, 0x4D, 0x58, 0x56, 0x44, 0x44, 0x4A, 0x20, 0x31, 0x30, 0x30, 0x30};
            byte[] header2 = BitConverter.GetBytes(ddjStreamLen);
            byte[] header3 = {0x03, 0x00, 0x00, 0x00};

            Array.Copy(header1, 0, ddjStream, 0, header1.Length);
            Array.Copy(header2, 0, ddjStream, header1.Length, header2.Length);
            Array.Copy(header3, 0, ddjStream, header1.Length + header2.Length, header3.Length);
            Array.Copy(ddsStream, 0, ddjStream, header1.Length + header2.Length + header3.Length, ddsStream.Length);

            return ddjStream;
        }
11/11/2011 23:08 madutz1#3
Quote:
Originally Posted by bheaven View Post
DDJ can be easily converted to DDS which can be opened in various image editors.

c# snippet:
Code:
        static public byte[] DDJ_to_DDS(byte[] ddjStream)
        {
            byte[] ddsStream = new byte[ddjStream.Length - 20];

            Array.Copy(ddjStream, 20, ddsStream, 0, ddsStream.Length);

            return ddsStream;
        }


        static public byte[] DDS_to_DDJ(byte[] ddsStream)
        {
            byte[] ddjStream = new byte[ddsStream.Length + 20];

            Int32 ddjStreamLen = ddsStream.Length + 8;

            byte[] header1 = {0x4A, 0x4D, 0x58, 0x56, 0x44, 0x44, 0x4A, 0x20, 0x31, 0x30, 0x30, 0x30};
            byte[] header2 = BitConverter.GetBytes(ddjStreamLen);
            byte[] header3 = {0x03, 0x00, 0x00, 0x00};

            Array.Copy(header1, 0, ddjStream, 0, header1.Length);
            Array.Copy(header2, 0, ddjStream, header1.Length, header2.Length);
            Array.Copy(header3, 0, ddjStream, header1.Length + header2.Length, header3.Length);
            Array.Copy(ddsStream, 0, ddjStream, header1.Length + header2.Length + header3.Length, ddsStream.Length);

            return ddjStream;
        }
i have convertor to dds . but .. i cant open dds with photoshop ... and i want to convert jpg or png or to save directly dds or ddj ..
11/12/2011 08:05 whyt3boi#4
You need the .dds plugin for photoshop to be able to edit them.

[Only registered and activated users can see links. Click Here To Register...]
11/12/2011 09:50 madutz1#5
Quote:
Originally Posted by whyt3boi View Post
You need the .dds plugin for photoshop to be able to edit them.

[Only registered and activated users can see links. Click Here To Register...]
FINALY THANKS SO MUCH :X