More Image-Format for save and load!

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

http://caosandkin.bei.t-online.de/pureb ... eimage.zip

I found FreeImage-DLL, which has follow support:

Code: Select all

;  Supported   : .BMP     [IN/OUT] Windows or OS/2 Bitmap
;                .WBMP    [IN/OUT] Wireless Bitmap - A bitmap type used by cell phones, etc.  Black & white.
;                .PBM     [IN/OUT] Portable Bitmap - Black & white ASCII based bitmap format
;                .PGM     [IN/OUT] Portable Greymap - Grayscale ASCII based bitmap format
;                .PPM     [IN/OUT] Portable Pixmap - High color ASCII based bitmap format
;                .PBMRAW  [IN/OUT] (Binary version of .PBM)
;                .PGMRAW  [IN/OUT] (Binary version of .PGM)
;                .PPMRAW  [IN/OUT] (Binary version of .PPM)
;                .ICO     [IN    ] Windows Icon
;                .PSD     [IN    ] Adobe Photoshop Document
;                .JPEG    [IN/OUT] Joint Photographic Experts Group (JFIF Compliant) - Popular high color bitmap format used on the WWW
;                .JBIG    [IN/OUT] Joint Bi-level Image experts Group.  Cousin of JPEG, but B&W (REQUIRES PLUG-IN)
;                .JNG     [IN    ] JPEG Network Graphics.  Cousin of MNG, but uses JPEG compression
;                .PNG     [IN/OUT] Portable Network Graphics - The answer to GIF when UNISYS became intrusive about their LZW compression algorithm
;                .MNG     [IN    ] Multiple Network Graphics - PNG; s answer To animated GIF.
;                .PCX     [IN    ] Zsoft Paintbrush
;                .TIFF    [IN/OUT] Tag Image File Format - A widely used format for storing image data
;                .TARGA   [IN    ] Tagged Image File Format - Popular bitmap format on the Amiga and other computers
;                .KOALA   [IN    ] KOALA files were popular on the commodore 64. Added for nostalgic reasons
;                .PCD     [IN    ] Kodak PhotoCD. The PhotoCD format was developed by Kodak as an alternative to
;                                  analog photography. Natively supported by most DVD players and CD-I.
;                .RAS     [IN    ] Sun Raster File - Popular among Solaris computers
;                .IFF     [IN    ] Interchanged File Format - Designed by Electronic Arts as an Amiga image storage format
;                .LBM     [IN    ] LBM was created for the Deluxe Paint package, and is essentially the same as IFF. (still part of FreeImage.dll for backwards compatibility)
;                .CUT     [IN    ] Dr.Halo bitmap - Pretty popular some years ago
I found the DLL at: http://w3.one.net/~kevinw/VB/d_DLL.htm
btw: There is a ZLib_VB.DLL for Visual Baisc -> somebody should convert it...

I write some routines to load and save Images easlier.
The the end of the PB are some example.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by GPI

Code: Select all

;                .IFF     [IN    ] Interchanged File Format - Designed by Electronic Arts as an Amiga image storage format;                .LBM     [IN    ] LBM was created for the Deluxe Paint package, and is essentially the same as IFF. (still part of FreeImage.dll for backwards compatibility)
Actually IFF is quite different from (I)LBM since it is not an image format, only a container type of file format. To store an image in an IFF file you had to embed an ILBM inside it.
I found the DLL at: http://w3.one.net/~kevinw/VB/d_DLL.htm
btw: There is a ZLib_VB.DLL for Visual Baisc -> somebody should convert it...
http://www.gzip.org/zlib for the homepage, which also has links to some other interesting compression stuff.


--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.51, Ed3.53)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

>Actually IFF is quite different from (I)LBM since
>it is not an image format, only a container type
>of file format. To store an image in an IFF file
>you had to embed an ILBM inside it.

I had only copy the beginn of the orginal .bas from VB-Basic. I have found many errors in the original VB-Modul. (The wrong function is called, for example).

But i think, this DLL is the best solution to save a 256-Color-Picture. Or save a Picture to PNG.

Lock at the example, there

FI_LoadImage - Load a image
FI_SaveImage - save a image
FI_CatchImage - load a image from memory (so you can include a JPG-picture in your programm)
FI_setclipboard - Copy a Picture to Clipboard (with Color-Conversion)
FI_GetClipBoard - Copy a Image from the Clipboard to a #image


PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
I had only copy the beginn of the orginal .bas from VB-Basic. I have found many errors in the original VB-Modul. (The wrong function is called, for example).
OK, I did wonder why you had put comments at the start of the lines :)

[quote
But i think, this DLL is the best solution to save a 256-Color-Picture. Or save a Picture to PNG.
[/quote]

Yes, it does seema very nice solution for multiple file formats.


--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.51, Ed3.53)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Inner.

the nicest is XnView

http://www.xnview.com

however translating it to pb has proved somewhat a hard task. your looking for the SDK.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

@inner:

OK, i will look at this, but in the moment i have, what i want: PNG-Support and 256-Color-Depth.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
Post Reply