PNG Plugin

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
shanefarris
Greenskin
Posts: 107
Joined: Sun Mar 01, 2009 8:36 pm
x 7

PNG Plugin

Post by shanefarris »

This was just a simple proof of concept that one of our developers here at Skyvu http://sky.vu/ put together. We are considering using Ogre as an engine in the future, and FreeImage wasn't an option for us because we didn't want to open our entire engine. This was just a simple test, and only built on Windows, but if you have any issues, let us know and we'll do our best to help.

Here's the source, do whatever you want with it, no license.
https://github.com/Skyvu/PNG_plugin

Just the logo being rendered with the plugin and not FreeImage.
Image
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: PNG Plugin

Post by spacegaier »

Thanks a lot for sharing this!
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: PNG Plugin

Post by c6burns »

If you opt for the FreeImage Public License then you don't have to. Still this is cool!
shanefarris
Greenskin
Posts: 107
Joined: Sun Mar 01, 2009 8:36 pm
x 7

Re: PNG Plugin

Post by shanefarris »

c6burns wrote:If you opt for the FreeImage Public License then you don't have to. Still this is cool!
Ok, good to know, I will need to look into this some more.
User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 15
Contact:

Re: PNG Plugin

Post by fractile »

Thanks. I've been thinking of cutting down some unneeded Ogre dependencies and this might be exactly what I need, since I use only PNG textures. I'll be looking into this..
User avatar
fractile
Gremlin
Posts: 199
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland
x 15
Contact:

Re: PNG Plugin

Post by fractile »

I switched from FreeImage to this and I have one little problem with it. RGB and RGBA textures load just fine, but loading PNG with 8-bit grayscale + alpha (saved by GIMP) does not work right. All transparent pixels are rendered black. If I save the same texture as 32-bit RGBA, it renders as it should.
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: PNG Plugin

Post by Transporter »

I had similar problems with FIPL. A known lawyer was not so happy about the license text. I've written an email to the FreeImage team to clear the vague parts. The reply was the following:
Hi,

First, you may be interested by similar and recurrent questions :
http://ehc.ac/p/freeimage/discussion/search/?q=license

Note that § 1.9 of the FIPL is a definition, not a requirement

Next, all you need to know is explained here :
http://freeimage.sourceforge.net/license.html

When using FreeImage in your commercial application, you are REQUIRED to :
distribute the FIPL license with your application (i.e. the TXT file)
provide a suitable acknowledgment, either in the program's "About" box or in the user's manual (or both)


That's all !
=> if its not clear enough for you : you can use FreeImage the way you want (provided you use the FIPL license), as long as you acknowledge the origin of the sources.

NB: if you have a lawyer on hand, I'd be happy to have recommendations on possible changes to the communication on the license or the license itself, so that this kind of question is no longer asked.

Best regards,
Hervé Drolon
FreeImage Project Manager
austinkoehler
Gnoblar
Posts: 1
Joined: Wed May 28, 2014 7:19 pm

Re: PNG Plugin

Post by austinkoehler »

fractile wrote:I switched from FreeImage to this and I have one little problem with it. RGB and RGBA textures load just fine, but loading PNG with 8-bit grayscale + alpha (saved by GIMP) does not work right. All transparent pixels are rendered black. If I save the same texture as 32-bit RGBA, it renders as it should.
Hello, I am the original author of this PNG plugin. I've looked into your issue, fractile, and believe it's because I somehow skipped over the 4/4 Alpha/Luminance format.

In SkyVuPNGCodec.cpp, at line 148 in the bit_depth switch, replace cases 1, 2, and 4 with the following:

Code: Select all

case 1: case 2:
	imgData->format = PF_L8;
	break;
case 4:
	if(imgData->flags & PFF_LUMINANCE)
	{
		if(imgData->flags & PFF_HASALPHA)
		{
			imgData->format = PF_A4L4;
		}
		else
		{
			imgData->format = PF_L8;
		}
	}
	else // rgb
	{
		stream->close();
		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
		OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
		"Error: Unsupported format.",
		"PNGCodec::decode");
	}
	break;
I'm not 100% sure that this will fix the issue, as 8-bit color tends towards palette territory which Ogre doesn't seem to support.
Post Reply