Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  DevILed eggs and PNGs  (Read 2343 times)
0 Members and 1 Guest are viewing this topic.
Offline anarchotron

Junior Member




...precious bodily fluids.


« Posted 2005-07-25 04:14:24 »

Today I switched my texture loader over from using ImageIO.read() to using the DevIL features.  I find that the images returned from DevIL are highly saturated for some unknown reason.  Is this a known problem?

Here are the comparison screenshots:



Here is the dirt texture as a reference


Here is the super-simple code I use to load:


   protected boolean loadInternal(String filename)
    {
        IntBuffer images = BufferUtils.createIntBuffer(1);
        IL.ilGenImages(images);
        images.rewind();
        IL.ilBindImage(images.get());
        boolean result = IL.ilLoadImage(filename);

        if (result == false)
        {
            Warning.emit("DataSourceTextureObject.loadFromStream() failed to create image from InputStream");
            return false;
        }

        setDepth((short) IL.ilGetInteger(IL.IL_IMAGE_BPP));
        setWidth((short) IL.ilGetInteger(IL.IL_IMAGE_WIDTH));
        setHeight((short) IL.ilGetInteger(IL.IL_IMAGE_HEIGHT));

        ILU.iluFlipImage();

        int numPixels = getWidth() * getHeight();
        ByteBuffer data = BufferUtils.createByteBuffer(numPixels * 4);
        IL.ilCopyPixels(0, 0, 0, getWidth(), getHeight(), 1, IL.IL_RGBA, IL.IL_BYTE, data);

        data.rewind();
        setPixels(data);

        return true;
    }

Thanks!
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #1 - Posted 2005-07-25 06:08:57 »

http://kaioa.com/k/dirt2.png

Try this image... it should look identical with both loaders.

The difference? I removed the gamma/chroma aux chunks from the png (with pngtweak).

弾幕 ☆ @mahonnaiseblog
Offline whome

Junior Member




Carte Noir Java


« Reply #2 - Posted 2005-07-30 10:11:38 »

Where is "pngtweak" util, all MrGoogle gave me was a link to this post :-)
....wait do you mean "TweakPNG" tool found here http://entropymine.com/jason/tweakpng/

Why is gamma/chroma chunks so evil in DevIL library?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #3 - Posted 2005-07-30 17:47:30 »

Ye... tweakpng.

>Why is gamma/chroma chunks so evil in DevIL library?

They aren't really "evil". It's just... they either get interpreted or get ignored. If they aren't existant (they are optional) this issue is completly avoided.

Saving pngs with pngout will also remove all optional chunks (unless specified otherwise).

弾幕 ☆ @mahonnaiseblog
Offline whome

Junior Member




Carte Noir Java


« Reply #4 - Posted 2005-07-31 10:39:56 »

Thx, I've now two small png utility installed. I even found pngout.dll plugin for IrfanView image tool.
http://pmt.sourceforge.net/pngcrush/
http://advsys.net/ken/utils.htm#pngout

Pngout site has pngout.dll file to be copied to IrfanView3.97 plugin folder. It provides a nice SaveAs dialog box.
http://irfanview.com/
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #5 - Posted 2005-07-31 13:12:33 »

I also use irfanview-version for a while... Before I use the command line thing via send-to, but with irfanview its much nicer to handle, because the options can be nicely accessed and there is transparency and that "finish after this pass" button thingy is also damn nice Smiley

Btw there are several irfanview packs. The bigger one comes with the pngout plugin.

Other nice png programms are pngrewrite and pngquant.

"Pngrewrite is little utility that reduces the unnecessarily large palettes that too many programs write into PNG files. It also optimizes transparency settings, and reduces the bits-per-pixel if possible. Handy for post-processing images before putting them on a web site."

"pngquant is a command-line utility to quantize and dither 32-bit RGBA PNGs down to 8-bit (or smaller) RGBA-palette PNGs, usually with a significant reduction in file size"

弾幕 ☆ @mahonnaiseblog
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

radar3301 (11 views)
2014-09-21 23:33:17

BurntPizza (29 views)
2014-09-21 02:42:18

BurntPizza (19 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (30 views)
2014-09-19 03:14:18

Dwinin (47 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!