 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Samson Fu Guest
|
Posted: Mon Jun 07, 2004 6:48 am Post subject: Photoshop & delphi~~ |
|
|
I make a bmp in photoshop. That unable to load from delphi either design &
runtime. The BMP is 64x64 24 bits.
Does anyone get the same problem? This is a photoshop or delphi bug?
Thanks~
|
|
| Back to top |
|
 |
Lord Crc Guest
|
Posted: Thu Jun 10, 2004 3:50 am Post subject: Re: Photoshop & delphi~~ |
|
|
On Mon, 7 Jun 2004 14:48:57 +0800, "Samson Fu" <samson_fu (AT) hotmail (DOT) com>
wrote:
| Quote: | Does anyone get the same problem? This is a photoshop or delphi bug?
|
Yes, i just got it. It seems that Photoshop stores an invalid value
for the image size in the bitmap header. For a 256x256x24 image, it
stores 2 bytes over the actual image size. This confuses delphi which
relies on this info to be correct when present (for rgb images one can
set it 0 and delphi will calculate the true value).
The fix from my perspective is this:
In TBitmap.ReadDIB, find this line:
// biSizeImage can be zero. If zero, compute the size.
if biSizeImage = 0 then // top-down DIBs have negative height
Replace the if statement with this:
if (bmiHeader.biCompression = BI_RGB) then
this will force it to calculate the correct value for all
non-compressed RGB images, which should work always (as an RGB image
is per definition uncompressed, it just a matter of arithmetics).
Ill enter it into QC soon.
- Asbjørn
|
|
| Back to top |
|
 |
mrjumbles Guest
|
Posted: Thu Jun 10, 2004 10:34 pm Post subject: Re: Photoshop & delphi~~ |
|
|
i have found that it only happens when the bitmaps dimensions are a multiple
of 16.
"Lord Crc" <lordcrc (AT) hotmail (DOT) com> wrote
| Quote: | On Mon, 7 Jun 2004 14:48:57 +0800, "Samson Fu"
wrote:
Does anyone get the same problem? This is a photoshop or delphi bug?
Yes, i just got it. It seems that Photoshop stores an invalid value
for the image size in the bitmap header. For a 256x256x24 image, it
stores 2 bytes over the actual image size. This confuses delphi which
relies on this info to be correct when present (for rgb images one can
set it 0 and delphi will calculate the true value).
The fix from my perspective is this:
In TBitmap.ReadDIB, find this line:
// biSizeImage can be zero. If zero, compute the size.
if biSizeImage = 0 then // top-down DIBs have negative height
Replace the if statement with this:
if (bmiHeader.biCompression = BI_RGB) then
this will force it to calculate the correct value for all
non-compressed RGB images, which should work always (as an RGB image
is per definition uncompressed, it just a matter of arithmetics).
Ill enter it into QC soon.
- Asbjørn
|
|
|
| Back to top |
|
 |
Lord Crc Guest
|
Posted: Sat Jun 12, 2004 4:40 am Post subject: Re: Photoshop & delphi~~ |
|
|
On Fri, 11 Jun 2004 06:34:14 +0800, "mrjumbles"
<fauxbrick2CUTTHIS (AT) hotmail (DOT) com> wrote:
| Quote: | i have found that it only happens when the bitmaps dimensions are a multiple
of 16.
|
Ah, nice catch. Now anyway, theres no need NOT to calculate the value
as i can see, because as an uncompressed RGB image, its defined by its
dimentions, and it's clearly the better route to take imho.
- Asbjørn
|
|
| Back to top |
|
 |
Wykis Guest
|
Posted: Sun Jun 27, 2004 9:00 am Post subject: Re: Photoshop & delphi~~ |
|
|
Why Don't You Try To Edit Image With "MS Paint" And Save It Into Another
File?
"Samson Fu" <samson_fu (AT) hotmail (DOT) com> wrote
| Quote: | I make a bmp in photoshop. That unable to load from delphi either design &
runtime. The BMP is 64x64 24 bits.
Does anyone get the same problem? This is a photoshop or delphi bug?
Thanks~
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|