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 

TBipmap won't load .bmp saved with photoshop

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





PostPosted: Wed Jun 16, 2004 8:25 pm    Post subject: TBipmap won't load .bmp saved with photoshop Reply with quote



Hi,

I have a problem with the TBitmap. It appears it won't load .bmp files that
are created using Photoshop (notmap RGB photo). PaintShop will read it as
will Windows Paint. Still I get a Stream Read Error when trying to load the
bmp in a TBitmap.

Does anyone recognize this?

Btw. I use Delphi 7

Thank s in advance

Hert


Back to top
Hertwig
Guest





PostPosted: Wed Jun 16, 2004 8:29 pm    Post subject: Re: TBipmap won't load .bmp saved with photoshop Reply with quote



ps bmp files created with other applications can be loaded without problems.


Back to top
Samson Fu
Guest





PostPosted: Thu Jun 17, 2004 12:47 am    Post subject: Re: TBipmap won't load .bmp saved with photoshop Reply with quote



Yes, this issue appears when your BMP file size is multiple of 16..
I don't know how to fix this in delphi. But you can load the bmp in windows paint and save again, then delphi is able to read the
bmp..

--
Samson Fu
"Hertwig" <bont2 (AT) hotmail (DOT) com> wrote

Quote:
Hi,

I have a problem with the TBitmap. It appears it won't load .bmp files that
are created using Photoshop (notmap RGB photo). PaintShop will read it as
will Windows Paint. Still I get a Stream Read Error when trying to load the
bmp in a TBitmap.

Does anyone recognize this?

Btw. I use Delphi 7

Thank s in advance

Hert





Back to top
Lord Crc
Guest





PostPosted: Thu Jun 17, 2004 1:14 pm    Post subject: Re: TBipmap won't load .bmp saved with photoshop Reply with quote

On Wed, 16 Jun 2004 22:25:16 +0200, "Hertwig" <bont2 (AT) hotmail (DOT) com>
wrote:

Quote:
I have a problem with the TBitmap. It appears it won't load .bmp files that
are created using Photoshop (notmap RGB photo). PaintShop will read it as
will Windows Paint. Still I get a Stream Read Error when trying to load the
bmp in a TBitmap.

Does anyone recognize this?

Yes, it's a bug in Photoshop. To work around it, copy graphics.pas to
the folder of your project, and perform the following (taken from my
previous post on this issue):

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).

- Asbjørn

Back to top
Hertwig
Guest





PostPosted: Thu Jun 17, 2004 1:45 pm    Post subject: Re: TBipmap won't load .bmp saved with photoshop Reply with quote

Thanks Lord Crc,

That did it! I can read the bitmap now.

Hert


----------------------------------------------------
"Lord Crc" <lordcrc (AT) hotmail (DOT) com> wrote

Quote:
On Wed, 16 Jun 2004 22:25:16 +0200, "Hertwig" wrote:

I have a problem with the TBitmap. It appears it won't load .bmp files
that
are created using Photoshop (notmap RGB photo). PaintShop will read it as
will Windows Paint. Still I get a Stream Read Error when trying to load
the
bmp in a TBitmap.

Does anyone recognize this?

Yes, it's a bug in Photoshop. To work around it, copy graphics.pas to
the folder of your project, and perform the following (taken from my
previous post on this issue):

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).

- Asbjørn



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.