Jump to content


Photo

Gmfi: Freeimage Wrapper - V0.02


  • Please log in to reply
47 replies to this topic

#1 Adventus

Adventus

    GMC Member

  • New Member
  • 516 posts

Posted 14 June 2007 - 06:38 AM

GMFI: FreeImage Wrapper beta
By Adventus


Just thought this might be useful for those image editting programs i see popping up now and again. This dll wraps 60 odd functions from the awesome opensource FreeImage DLL.... ill probably add more if they're required (who wants meta-data functions?). I havent (yet) managed to statically link the freeimage.dll with my MinGW compiler so you'll have to distribute both the "gmfi.dll" and the "FreeImage.dll" (in the same directory) with your games. Aswell as the large number of supported formats, there's also an equivalent function for almost every operation in the GM paint program. Due to the huge number of function combinations and my over-riding laziness, i havent tested everything.... so give it ago and tell me if you can get it to screw up.

Download Info:
Files in zip: gmfi.gmd, gmfi.dll and FreeImage.dll
Helpfile: FreeImage Helpfile - You'll need it!
Posted Image

Supported Image Formats:
- BMP files [reading, writing]
- DDS files [reading]
- Dr. Halo files [reading]
- GIF files [reading, writing]
- HDR files [reading, writing]
- ICO files [reading, writing]
- IFF files [reading]
- JBIG [reading, writing]
- JNG files [reading]
- JPEG/JIF files [reading, writing]
- KOALA files [reading]
- LBM files [reading]
- Kodak PhotoCD files [reading]
- MNG files [reading]
- PCX files [reading]
- PBM files [reading, writing]
- PGM files [reading, writing]
- PNG files [reading, writing]
- PPM files [reading, writing]
- PhotoShop files [reading]
- Raw Fax G3 files [reading]
- SGI files [reading]
- Sun RAS files [reading]
- TARGA files [reading, writing]
- TIFF files [reading, writing]
- WBMP files [reading, writing]
- XBM files [reading]
- XPM files [reading, writing]

Upcoming Features:
- Save/Load flags: So you can access the numerous options avaliable when loading and saving images.
- Command Interpreter: Allow you to write simple pixel manipulation functions withoutgoing through GM.
- Static Linking: I'll be able to halve the size of the dll by ripping out the meta data functions, and it'll mean you only need to distribute one dll.

Version Log:
+ v0.02:
- Added save/load flags. Check gmfi_flags() script to find what flags to use for a format.
- Added Tonemapping functions. You can now successfully covert HDR files to standard RGB format.

Edited by Adventus, 16 June 2007 - 08:57 AM.

  • 0

#2 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 14 June 2007 - 07:17 AM

Nice dll.
I'm very much suprised you have made a HDRi image support.The most higest
quality image.
I was seraching this for years.Now I find it here.

This is only your beta,so you can add a support for resizing images too.

Anyway I like this dll a lot.Thankyou for making this :)
  • 0

#3 Adventus

Adventus

    GMC Member

  • New Member
  • 516 posts

Posted 14 June 2007 - 07:24 AM

This is only your beta,so you can add a support for resizing images too.

You can use gmfi_copy() to just change the size (strange name i know, but thats what freeimage calls it) or gmfi_rescale() to scale it up.

Cheers,

EDIT: Or you could allocate a new image using gmfi_allocate() and draw the other image on top using gmfi_paste().

Edited by Adventus, 14 June 2007 - 07:26 AM.

  • 0

#4 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 14 June 2007 - 07:30 AM

I'll try that.
  • 0

#5 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 14 June 2007 - 10:34 AM

whoa - nice DLL!!!
  • 0

#6 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 14 June 2007 - 02:44 PM

Something all image manipulation dlls seem to lack is the ability to make a change according to code. Of course you can do that by using several gml to dll calls, but it is painfully slow. So put up a sort of mini language of your own, now need for expressions and such, the only might be requirment is variables. Then put this interpreter into the dll. This makes image manipulation 80% faster (100% if compiled but that's unlikely if not impossible to implement).
  • 0

#7 TGMG

TGMG

    G-java creator

  • New Member
  • 706 posts
  • Version:GM8

Posted 14 June 2007 - 03:23 PM

This is very good but the dll is 1mb, which is the same size as gmmagick with much less features, compress your dlls:
http://upload.g-java.....e maker/Dlls

Thats better :)

I used ASPack btw :)
  • 0

#8 OpticalLiam

OpticalLiam

    GMC Member

  • New Member
  • 782 posts

Posted 14 June 2007 - 03:59 PM

Sweet, this will come in useful for compressing generated light maps.

The quality of a PNG to JPEG conversion I did was pretty bad, but I'm sure that compression/quality is adjustable?
  • 0

#9 Adventus

Adventus

    GMC Member

  • New Member
  • 516 posts

Posted 15 June 2007 - 01:53 AM

Something all image manipulation dlls seem to lack is the ability to make a change according to code. Of course you can do that by using several gml to dll calls, but it is painfully slow. So put up a sort of mini language of your own, now need for expressions and such, the only might be requirment is variables. Then put this interpreter into the dll. This makes image manipulation 80% faster (100% if compiled but that's unlikely if not impossible to implement).

Thats definitely a posibility, should be fun to implement as well. Also FreeImage is Plugin driven, so in the future ill probably add the option to make it call an external dll.... so you wouldnt need the GM interface at all.

This is very good but the dll is 1mb, which is the same size as gmmagick with much less features, compress your dlls:
http://upload.g-java.....e maker/Dlls

Thats better

I used ASPack btw

Yea thats a good idea, except the change isnt quite as much as you would expect due to the zip compression. My zip is 520kb yours is 460kb but the difference in dll size is about half. Once i manage to statically link it, ill be able to dig around and probably tear out plenty of the uneeded functions, I've heard i can halve the dll size pretty easily. Yea GMmagick was good, but it does require lugging around a 1.2mb exe which has serious problems with compression.

Sweet, this will come in useful for compressing generated light maps.

The quality of a PNG to JPEG conversion I did was pretty bad, but I'm sure that compression/quality is adjustable?

Yea, i havent yet added flags on the load/save functions (which adds an expotential amount of options), although it should be easy. Ill definitely do this soon. I mainly released it this early so i can get an idea if any of the functions are misbehaving. Yea that was my idea with making it aswell, compressing lightmaps & bumpmaps.

Cheers,

Edited by Adventus, 15 June 2007 - 01:56 AM.

  • 0

#10 A.R.T.games

A.R.T.games

    GMC Member

  • GMC Member
  • 395 posts
  • Version:GM:Studio

Posted 15 June 2007 - 05:21 AM

thx u so much Adventus. i cam to this site for just this and i fond this just like that!
  • 0

#11 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 15 June 2007 - 09:04 AM

Glad you liked my idea!

Edit: BTW I could help in making the 'mini language'. What is your dll made in? PB i thought right? Well it would be difficult coz I never used PB only basic. Still I could put up a prototype in GMl so you would just need to translate it into PB.
And another thing, I got the idea from GIMP :P so it ain't exactly mine.

Edited by uuf6429, 15 June 2007 - 09:28 AM.

  • 0

#12 Adventus

Adventus

    GMC Member

  • New Member
  • 516 posts

Posted 15 June 2007 - 09:37 AM

I've already done a fair bit of the base work for making an interpretter, but i would still be interested in seeing your gml prototype. My dlls written in c++....
  • 0

#13 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 15 June 2007 - 11:20 AM

How can I move the freeimage dll to a folder and load it from it. I got the gmfi dll in the folder a loaded it, but It doesn't work for freeimage.
  • 0

#14 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 15 June 2007 - 12:51 PM

Adventus,will you make a dds conversion.

The hdr format is not working stable.Has anyone else tried testing this.

I have other hdr textures working fine, but the one I made with Gmfi does not work properly.

Edited by freko, 15 June 2007 - 12:53 PM.

  • 0

#15 Adventus

Adventus

    GMC Member

  • New Member
  • 516 posts

Posted 16 June 2007 - 01:00 AM

How can I move the freeimage dll to a folder and load it from it. I got the gmfi dll in the folder a loaded it, but It doesn't work for freeimage.

Sigh, from 1st post:

I havent (yet) managed to statically link the freeimage.dll with my MinGW compiler so you'll have to distribute both the "gmfi.dll" and the "FreeImage.dll" (in the same directory) with your games.

Adventus,will you make a dds conversion.

The hdr format is not working stable.Has anyone else tried testing this.

I have other hdr textures working fine, but the one I made with Gmfi does not work properly.

Are you sure they're .hdr files? Not one of the other hdr formats. What program/s are you reading them with? I havent been able to test, due to the fact i have no hdr images.

I managed to create what appeared to be a .hdr image by loading an RGB image(gif, png, bmp, etc) with gmfi_load() the converting it to the hdr format with gmfi_convert_RGBF() and saving with gmfi_save(). Not sure if this is what your trying to achieve....

Cheers,
  • 0

#16 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 16 June 2007 - 06:45 AM

Are you sure they're .hdr files? Not one of the other hdr formats. What program/s are you reading them with? I havent been able to test, due to the fact i have no hdr images.

<{POST_SNAPBACK}>

Ofcourse they were hdr formats.I use 3ds max to read hrd images.
I have some hdr images which came along with 3ds max..

Edited by freko, 16 June 2007 - 06:46 AM.

  • 0

#17 Adventus

Adventus

    GMC Member

  • New Member
  • 516 posts

Posted 16 June 2007 - 07:52 AM

Im really just taking stabs in the dark here, but are you trying to save them as something other than the hdr (or equivalent) format? This will not work because you must tonemap a hdr image down before saving in the 24bit range.... ill add tonemapping functions to the wrapper now and probably make a small update sometime in the next 3 hours.

Edit: Updated -> look at first post.

Edited by Adventus, 16 June 2007 - 08:53 AM.

  • 0

#18 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 16 June 2007 - 10:49 AM

My dlls written in c++....

Perfect I know good c++ so I could try at doing the code in c++
  • 0

#19 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 16 June 2007 - 10:51 AM

The new version does not work.
Shows an error at startup loading:-

Posted Image
  • 0

#20 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 16 June 2007 - 11:01 AM

Find that piece of code and replace "room_height-2)" to "room_height-2,0)"
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users