BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Photoshop & delphi~~

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Samson Fu
Guest





PostPosted: Mon Jun 07, 2004 6:48 am    Post subject: Photoshop & delphi~~ Reply with 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
Lord Crc
Guest





PostPosted: Thu Jun 10, 2004 3:50 am    Post subject: Re: Photoshop & delphi~~ Reply with quote



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





PostPosted: Thu Jun 10, 2004 10:34 pm    Post subject: Re: Photoshop & delphi~~ Reply with quote



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





PostPosted: Sat Jun 12, 2004 4:40 am    Post subject: Re: Photoshop & delphi~~ Reply with quote

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





PostPosted: Sun Jun 27, 2004 9:00 am    Post subject: Re: Photoshop & delphi~~ Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.