 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Hertwig Guest
|
Posted: Wed Jun 16, 2004 8:25 pm Post subject: TBipmap won't load .bmp saved with photoshop |
|
|
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
|
Posted: Wed Jun 16, 2004 8:29 pm Post subject: Re: TBipmap won't load .bmp saved with photoshop |
|
|
ps bmp files created with other applications can be loaded without problems.
|
|
| Back to top |
|
 |
Samson Fu Guest
|
Posted: Thu Jun 17, 2004 12:47 am Post subject: Re: TBipmap won't load .bmp saved with photoshop |
|
|
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
|
Posted: Thu Jun 17, 2004 1:14 pm Post subject: Re: TBipmap won't load .bmp saved with photoshop |
|
|
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
|
Posted: Thu Jun 17, 2004 1:45 pm Post subject: Re: TBipmap won't load .bmp saved with photoshop |
|
|
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 |
|
 |
|
|
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
|
|