Discussion:
BMP issues
RBNUBE
2007-01-23 06:24:06 UTC
Permalink
I'm storing FolderItems (images) in the CellTags of a ListBox. A save
function dumps the images out as BMP files based on these FolderItems.

Two odd things are happening:
1) The dimensions and resolutions of the images are not the same as the
originals. I would like for them to be the same, if possible.

For example:
A image with the properties of 5" x 5" at 72 PPI will end up being 192" x
192" at 1.875 PPI.

2) The original files do not have an alpha channel. The generated BMP
files all have an alpha channel. I don't want or need an alpha channel and
this extra channel is adding a considerable about of size to the file (380K
without alpha, 570K with alpha).


Here is my code. Any suggestions?

Thanks!

Dim testForFolderItem as Variant

testForFolderItem = clbCatsNItems.CellTag(i, 3)

If testForFolderItem isA FolderItem and testForFolderItem <> nil then
itemPic = FolderItem(testForFolderItem).OpenAsPicture
itemPicFile = deptPicFolder.Child(picNamePartNumer)
If itemPic <> nil then
// Save pic.
If itemPic <> nil and itemPicFile <> nil then
itemPicFile.SaveAsPicture(itemPic)
clbCatsNItems.CellTag(i, 3) = itemPicFile
Else
MsgBox "Could not process image file."
End If
End If
End If


RB5.5.5 and a mostly unused copy of 2006r2.
WinXP, 2.2 GHz, 2G RAM
RBNUBE
2007-01-24 02:28:35 UTC
Permalink
Unfortunately, Gordon Brooks is the only person who responded to my post <G>
RBNUBE
2007-01-31 00:55:12 UTC
Permalink
Just for the heck of it, I tried this code in a demo of RB2007r1. In
RB2007r1 the DPI settings are now fixed, but the BMP still has an alpha
channel. I still wonder if there isn't a way around this...



-----Original Message-----
From: gettingstarted-***@lists.realsoftware.com
[mailto:gettingstarted-***@lists.realsoftware.com] On Behalf Of RBNUBE
Sent: Tuesday, January 23, 2007 1:24 AM
To: RB-GettingStarted
Subject: BMP issues


I'm storing FolderItems (images) in the CellTags of a ListBox. A save
function dumps the images out as BMP files based on these FolderItems.

Two odd things are happening:
1) The dimensions and resolutions of the images are not the same as the
originals. I would like for them to be the same, if possible.

For example:
A image with the properties of 5" x 5" at 72 PPI will end up being 192" x
192" at 1.875 PPI.

2) The original files do not have an alpha channel. The generated BMP
files all have an alpha channel. I don't want or need an alpha channel and
this extra channel is adding a considerable about of size to the file (380K
without alpha, 570K with alpha).


Here is my code. Any suggestions?

Thanks!

Dim testForFolderItem as Variant

testForFolderItem = clbCatsNItems.CellTag(i, 3)

If testForFolderItem isA FolderItem and testForFolderItem <> nil then
itemPic = FolderItem(testForFolderItem).OpenAsPicture
itemPicFile = deptPicFolder.Child(picNamePartNumer)
If itemPic <> nil then
// Save pic.
If itemPic <> nil and itemPicFile <> nil then
itemPicFile.SaveAsPicture(itemPic)
clbCatsNItems.CellTag(i, 3) = itemPicFile
Else
MsgBox "Could not process image file."
End If
End If
End If


RB5.5.5 and a mostly unused copy of 2006r2.
WinXP, 2.2 GHz, 2G RAM



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Lars Jensen
2007-02-01 07:00:54 UTC
Permalink
You could write RB code to generate the BMP file yourself. The format
isn't too complex, especially if you don't care about generating all
the possible flavors of it.

lj
RBNUBE
2007-02-02 14:18:50 UTC
Permalink
Post by Lars Jensen
You could write RB code to generate the BMP file yourself.
How would I go about doing that?
Lars Jensen
2007-02-03 21:54:24 UTC
Permalink
Post by RBNUBE
Post by Lars Jensen
You could write RB code to generate the BMP file yourself.
How would I go about doing that?
As file formats go, BMP is not that complex, and most apps don't
support all the obscure variations. If you just need a BMP file that
can be read by most graphics tools, then you write out a couple of
short headers and some picture data and you're done. (If you want less
than 24 bits per pixel, you'll have to generate and write a color
table too. Again, not hard.) If you're comfortable with bits and
bytes, then this probably represents about an afternoon's work. If
not, it's probably not a good workaround for you.

Google for "BMP file format" and start reading. Here are some pages I
found useful:

http://local.wasp.uwa.edu.au/~pbourke/dataformats/bmp/
http://en.wikipedia.org/wiki/Windows_bitmap
http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html
http://web.uccs.edu/wbahn/ECE1021/STATIC/REFERENCES/bmpfileformat.htm
http://atlc.sourceforge.net/bmp.html#_toc381201090
http://www.fileformat.info/format/bmp/egff.htm

lj

Loading...