 |
|
 |
In the ProccessBuffer(...) function, it's necessary to update nTotalBytes just like in ReadImageData(...) for RGB images with 2 bytes per pixel. Otherwise it will buffer overrun and crash during decode of these types of PSD files.
case 3: { int nBytesToRead = header_info.nBitsPerPixel / 8; if ( 2 == nBytesToRead ) { nBytesToRead = 1; nTotalBytes = nPixels * nBytesToRead * header_info.nChannels; }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hello everyone! Now I want to import PSD file in layer, that is each layer displays as one picture, but I can't understand the PSD format completely, such as what is the Channel Image Data in setcion four, what is different between Channel Imaga Data and Image Data in section five ..etc? can anyone give me an answer in detail? I want to communicate the PSD format with you, thanks for your help.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
I tried to download your code,but cannot do that,the massege is "download is fail",why? Can you help me? thank you very much!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
haha,there is no problem if I used the IE. perhaps TT have some bugs!!! Recently,I am learning the psd file format,and developing the psd viewer. Thanks a lot!!!
-- modified at 9:27 Friday 22nd June, 2007
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Based on this i have compiled a parser to be used in photoshop preview handler in Vista check here[^]
Do let me know what you think about that
Raj
Omit Needless Words - Strunk, William, Jr.
Vista? Photoshop Preview Handler here
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
hello, guy,
Can you tall me how can get psd thumbnail from psd files? If anyone know it,please tell me.Thanks.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
This is probably my last response.
Thumbnails are stored is a thumbnail resource format. Depending on the psd format for Photoshop 4.0 the resource ID is 1033 as of version 5.0 and later the ID is 1036.
Before reading the actual thumbnail’s data you need to read a header so that you can find out how to interpret them. Below you’ll find the necessary information in order to correctly interpret read and interpret the data.
4 bytes: Indicating the data’s format - 1 data are in JPEG RGB format – 0 RGB raw 4 bytes: Width of thumbnail in pixels 4 bytes: Height of thumbnail in pixels 4 bytes: Padded row bytes – (width * bitspixels + 31) / 32 * 4 4 bytes: Total size – width bytes * height * planes 4 bytes: Compressed size, just for consistency check 2 bytes: bitspixels - 24 bits per pixel 2 bytes: - 1 number of planes Variable size: Actual data. If resource ID is 1033 ie Photoshop 4.0 then data is in BGR format otherwise the RGB format is used.
You can either translate the JPEG format yourself or use any library that supports JPEG files.
Hope the above information is of help.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
|
 |
|
 |
Inside the code there is a loop:
std::string strOSType; for(unsigned int nChar = 0; nChar < 4; ++nChar) strOSType.push_back(image_resource.OSType[nChar]);
This can be translated into:
std::string strOSType = ""; for(unsigned int nChar = 0; nChar < 4; ++nChar) strOSType += image_resource.OSType[nChar];
Same way for any other push_back method used for std::strings
As for your other question regarding pop_back I couldn't find anywhere in my code where I might have used it.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |

And something else, it seems you haven't read the article as I explain how to translate the push_back method for std::string in the article's section:
How to make it compatible to Visual Studio 6
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
I'm sorry but I don't have that much free time in my disposal to answer all messages or even support and make modifications/additions to my code/article as much as I would love to have.
I wrote this article while working in my previous job where I had a lot more free time but less interesting job so "I was seeking for an outlet"
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I have used your files MyPSD.h and MyPSD.cpp in a simple ATL project to test them ...
there is no doubt that it is a great wrok ...
but I have a problem ... when I load supprted images ... it works fine ...
if I load at last one time an unsuporrted format ... it never works again ...
forexample,
Image x.psd is loaded successfully with error code 0 ... Image y.psd is not loaded successfully with error code -6 ... Image x.psd is not loaded successfully with error code -4 ... although it was loaded successfully before loading y.psd ...
could someone tell where is the problem please ....
I'm so confused ...
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
The only reason I can think of is perhaps I don't release memory and/or gdi objects correctly when an unsupported file is read.
Or I might have a bug ( bug in my code.....).
Just email me the problematic (y.psd) file I could try to see what I am doing wrong.
I should inform you though that for the next 2 weeks I'll be on vacations. Finally summer has arrived for my as well. 2 weeks with no computers, I need this time off to recharge my batteries.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
thanks a lot for your reply ...
I had traced your code step by step ... ...
At CPSD::ReadImageData(FILE* pFile) function ... I found the following pecie of code:
... unsigned char* p = pData; ... if ( 128 > len ) { len++; Count += len;
while (len) { (int)fread(&ByteValue, sizeof(ByteValue), 1, pFile); nValue = Calculate( ByteValue, sizeof(ByteValue) );
*p = nValue; p += sizeof(ByteValue); len--; } } else if ( 128 < len ) { len ^= 0x0FF; len += 2; (int)fread(&ByteValue, sizeof(ByteValue), 1, pFile);
nValue = Calculate( ByteValue, sizeof(ByteValue) ); Count += len;
while (len) { *p = nValue; p += sizeof(ByteValue); len--; } }
I think in someway that the pointer *p is become invalid ... I don't know how actually, cause I didn't made a deep look ... so I replaced the upper code by the following one ...
... unsigned char* p = pData; unsigned char* pEnd = &pData[nTotalBytes-1]; ... if ( 128 > len ) { len++; Count += len;
while (len) { (int)fread(&ByteValue, sizeof(ByteValue), 1, pFile); nValue = Calculate( ByteValue, sizeof(ByteValue) );
if(p >= pData && p <= pEnd) { *p = nValue; p += sizeof(ByteValue); } len--; } } else if ( 128 < len ) { len ^= 0x0FF; len += 2; (int)fread(&ByteValue, sizeof(ByteValue), 1, pFile);
nValue = Calculate( ByteValue, sizeof(ByteValue) ); Count += len;
while (len) { if(p >= pData && p <= pEnd) { *p = nValue; p += sizeof(ByteValue); } len--; } }
it works fine with me without problem ... ...
But I have another problem now ... when I load a 24 bit psd image ... and ask about the bit depth by calling BitsPerPixel() ... it returns 8 to me ... this happens with all 24 bit PSD images... ... and it recognized by the photo shop and many applications as 24 bits images ...
do you have any suggestions to me ... waiting yout reply...
wish you a nice day ...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Next version of the code will also have your changes.
As far as the 8bit I don't remember from where (image header etc) I read the value, out of my head for the moment I can imagine is Bits per pixel per channel, hence 8bits per pixel per 3 channels (RGB) equals 24. I think, I'll get back to you with the answer.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Can someone show me a way to save a picture in CMYK color mode?
With GDI+ 2.0, I can only save a bitmap(JPEG) in RGB color mode!
plz help me, urgently!!!
dsclub@hotmail.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
MyPSD is great, but I have one question...is there any way to keep the transparent background of a PSD file when it is placed into the HBITMAP object?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
As far as I know HBITMAP doesn't support transparency, but I might be wrong. HBITMAP is a handle (something like a pointer) to memory, you don't have access directly to the actual bits there. To get access to the data you use
::GetObject(..., ..., ....)
Check MSDN for more help.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Yes, bitmaps support even per-pixel RGBA values (per-pixel Alpha blending). This is not the problem.
I'd love to see code that does support this. The PSD code given here does give no hint of how to read/handle transparency channels.
Ch.
|
| Sign In·View Thread·PermaLink | 1.80/5 |
|
|
|
 |
|
 |
PSD allows for saving a selection ('walking ants') in the file. if the selection is saved within photoshop then it is also saved in the PSD file. Anyone knows how to retrieve the selection?
And going a step further, same question on Photoshop Paths.
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |