GIMP Chat
http://gimpchat.com/

Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)
http://gimpchat.com/viewtopic.php?f=9&t=195
Page 1 of 2

Author:  GnuTux [ Tue May 04, 2010 10:52 pm ]
Post subject:  Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Software List

OS: Fedora 12 (i686) (Gnome Desktop)
Gimp: v2.6.9
Gimp Apng Plug-in: v0.1.0
libpng-1.2.44
libpng-1.2.44-apng.patch
GNU C Compiler (gcc)

GIMP APNG Plug-in Installation Guide For Linux

This is a basic guide to installing GIMP APNG Plug-in in Linux. For demonstration purposes of this guide, Fedora 12 will be the distribution used. However, other than distro dependent install paths, the same basic steps would apply to other Linux distributions as well.

In this guide, we will

a) patch libpng with the libpng-apng-patch,
b) compile and install the patched libpng
c) compile GIMP-APNG-Plug-in against our newly patched libpng

You can also install a pre-patched libpng, if you can find one. ;)

If your distribution includes a pre-patched version of libpng with APNG support, you can skip directly to Section II.

Pre-install requirement

Ensure you have installed the development tools provided by your Linux distribution. In Fedora 12, the most popular and frequently used development tools automake, gcc, perl, python can be installed with a single click under: System/Administration/Add-Remove-Software (under Package Collection, select Development Tools

Ensure GIMP and libpng-devel are both installed on your system. Check your software repository to determine which version of libpng is used by your distribution.

Fedora 12 and Fedora 13 currently use libpng-1.2.44.



Section I - Patching, compiling and installing lipng with APNG support

1) Create a folder titled: gimp-apng
2) Download the libpng source code: for your distribution into the gimp-apng folder.

Fedora 12 uses: libpng-1.2.44 which can be downloaded here.

3) Extract libpng-1.2.44.tar.gz (creates a subfolder /gimp-apng/libpng-1.2.44).

4) Download the libpng-apng patch that corresponds to your distribution's version of libpng

Fedora 12 currently uses: libpng-1.2.44-apng.patch which can be downloaded here.

5) Extract the contents of libpng-1.2.44-apng.patch.gz and copy the patch file into the /gimp-apng/libpng-1.2.44 folder.
6) Open a terminal and change into the /gimp-apng/libpng-1.2.44 folder
7) As a normal user, patch libpng-1.2.44 with the libpng-1.2.44-apng.patch using the following command..

patch -p1 < libpng-1.2.44-apng.patch

8) Compile the patched libpng-1.2.44 using the following commands.

Note: Use the "--prefix" option to specify an installation path other than the current default of: /usr/local

In Fedora 12, we will use the install path: /usr

./configure --prefix=/usr
make

9) As Root, install the patched libpng-1.2.44 using the following command..

make install

Completing without error, a patched version of libpng with APNG support will be installed.



Section II: Compile and install the GIMP plug-in: gimp-apng-0.1.0

1) Download Gimp Apng Plug-in: v0.1.0 into your user created gimp-apng folder.
2) Extract gimp-apng-0.1.0.tar.bz2 (creates a subfolder /gimp-apng/gimp-apng-0.1.0).
3) Open a terminal into the /gimp-apng/gimp-apng-0.1.0 folder
4) As a normal user, run the following two commands..

./configure
make

5) As Root, install the Gimp Apng Plug-in..

make install

In Fedora 12, the Gimp Apng Plug-in will be installed in a newly created hidden folder under .gimp-2.6.x/plug-ins. You will have to manually copy the gimp-apng plug-in to your gimp-2.6/plug-ins folder. This is likely the case with most other Linux distributions as well.

I also highly recommend removing file-png from the system's plug-in folder (/usr/lib/gimp/2.0/plug-ins). This will direct control to the new gimp-apng-plugin by default when saving.

Once the plug-in is installed, you will have three new options for animated PNGs on the PNG save dialog.

Image

Note from the plugin Developer
Quote:
First frame must be full size (and second frame must be full size too, if first frame is hidden).

Failure to follow this convention will result in a save error..

libpng error: width and/or height in the first frame's fcTL don't match the ones in IHDR

I received this error when the top layer in my layer dialog was not the same size as the overall image.

Once I resized the top layer to the image size, I was able to save as an animated PNG.

This plugin also allows loading of multi-layer animated PNGs with all layers intact.



PNGs are a superior file format supporting 24bit color depth verses 8bit GIFs. .

Thanks to Oregonian for a great comparison of the difference between animated GIFs -vs- PNGs.

____GIF_________PNG____
ImageImage

A few more animated PNGs samples.

3D T-Rex
Image

Rotating Glass
Image

SpinFox
Image

Post updated: 07/07/2010 - (updated how-to on Fedora 12/13 to reflect updated libpng-1.2.44)

Author:  Oregonian [ Wed May 05, 2010 1:13 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

:wh My first animation using the gimp apng plugin. No semiflattening of drop shadows. Way kewl. This one is 104.1kg in size.

Image

Same image semiflattened, indexed and saved as a gif file. 55.4kb.

Image

Gradient areas need to be larger to see the dithering.

Author:  Oregonian [ Wed May 05, 2010 2:10 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

... another one with Silvertayl's Siamese Fighting Fish.
apng
Image

Author:  molly [ Wed May 05, 2010 4:59 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

cool. love the gimp chat font and sparkles love the turning jar, excellent... woot

Author:  GnuTux [ Wed May 05, 2010 2:10 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

These two images demonstrate the difference between animated PNG -vs- GIF really well. You can see the GIF struggling to produce the gradient, resorting to dithering. The PNG is smooth with no dithering.

GIF
Image

PNG
Image

It's all about color depth. :cool

Author:  Oregonian [ Wed May 05, 2010 2:45 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

Cool demo GnuTux. :2thup

Author:  Oregonian [ Wed May 05, 2010 8:14 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

I got the package of frames here. What I don't understand is why the frames (images) were all semi-flattened and index mode. I put them in rgb mode and un-semi-flattened them by running them through color to alpha and removed the white. The image on the right has the sign removed that detects he apng viewing capabilities of the image viewer.

ImageImageImage

Author:  GnuTux [ Thu May 06, 2010 1:25 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

I'll wager the person putting together that APNG demo just grabbed that stickman animation which was originally an animated gif. For purposes of demonstrating the online APNG creator, it really doesn't matter that the image started as a .gif.

He just grabbed something to save time. That's my guess. I've been there. :keybdtype

Wonder why we haven't seen a Windows version of this plug-in? Surely there are lots of winfans around with a C compiler. ;)

I've never attempted to setup a cross compiler environment but that might be fun. I hear it's kinda tricky to setup but it would be cool to be able to compile the same code across Linux, Windows & MAC with a few keystrokes.

Here's a good idea. Create a Cross Compiler Linux distribution (call it CC Linux) where everything is pre-configured and tweaked for development using a cross compiler environment. That would be sweet!! When do we start? :lol

Author:  Oregonian [ Thu May 06, 2010 8:47 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

GnuTux wrote:
Wonder why we haven't seen a Windows version of this plug-in? Surely there are lots of winfans around with a C compiler. ;)

I've never attempted to setup a cross compiler environment but that might be fun. I hear it's kinda tricky to setup but it would be cool to be able to compile the same code across Linux, Windows & MAC with a few keystrokes.

Here's a good idea. Create a Cross Compiler Linux distribution (call it CC Linux) where everything is pre-configured and tweaked for development using a cross compiler environment. That would be sweet!! When do we start? :lol

I've pretty much traveled the Internet looking for a Windows version and couldn't find one. Found a few places where there were requests. Usually it's we Linux users that have to wait for a Linux version. It should be taking off soon I would hope.

Great idea about a cross compiler. Your work is cut out for you. :keybdtype :sleepkbd

Author:  Oregonian [ Sat May 15, 2010 11:08 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-pat

Image Windows users go here for the Windows version.

Author:  GnuTux [ Wed Jul 07, 2010 9:50 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Updated the "How-To" section to reflect Fedora's update to libpng-1.2.44.

If you've previously compiled and installed the GIMP APNG plug-in v0.1.0, you can skip section II. You'll only need to patch and install the updated libpng-1.2.44.

Author:  Rod [ Thu Jul 08, 2010 2:17 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

sweet! =)
thanks GnuTux

Author:  YogiBare [ Mon Sep 20, 2010 3:03 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Hey,

I know its been a while but I've run into an issue and could use a little help :-)

I was able to successfully patch libpng-1.2.44 ( as I am using fedora 13 64bit )
Then I verified using make check before installing. The install completed with no errors.

However when I go to ./configure in the gimp-apng-0.1.0 directory the last two lines read the following;

checking for png_get_acTL in -lpng... no
configure: error: PNG library doesn't have APNG support

so i retried the entire process using prefix=/usr/lib64 (not sure if this changes anything really)
and still no dice :-(

Any hints?

Author:  GnuTux [ Mon Sep 20, 2010 3:30 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Greetings YogiBare,

I don't know very much about the 64bit version but I might be able to make a few suggestions that can help.

Do you know where libpng is normally located in F13 (x86_64)?

That's the key. The message from /.configure is telling you that your libpng has not been patched to support APNG (probably because it can't find it).

You should be able to do a file search starting from /File System to find out where libpng shared libs are normally stored in Fedora (x86_64).

libpng in normally stored /usr/lib in Fedora (i686). Here's what mine looks like..

Image

If indeed shared libs are normally stored in /usr/lib64 in Fedora x86_64, you'll need to make a change to the configuration file to reflect that.

In the libpng-1.2.44 folder, in file "configure", on or around line 943 you'll see the line

libdir='${exec_prefix}/lib'

The exec_prefix is appended with /lib, which you will need to change to /lib64, if indeed that's where the share libs are being stored.

The line then becomes..

libdir='${exec_prefix}/lib64'

Re-installing the patched libpng with an exec_prefix of "/usr" will place the shared libs in /usr/lib64.

You should then be able to proceed to compiling the APNG-plugin.

Hopefully, that's the only difference in terms of file locations in the x86_64 version of Linux. You can take a look at the entire block of installation directory options in the "configure" file to ensure there are no other differences.

I'll bet making that change solves your problem but please let me know and I'll update the guide for Fedora x86_64 users.

Author:  mahvin [ Sun Oct 24, 2010 7:27 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Thanks GnuTux for providing these instructions. :)

I'm on Ubuntu 10.04, so the process was very similar. One critical area that might confuse new Ubuntu users is Synaptic. Instead of System - Administration - Add/Remove, it will be System - Administration - Synaptic Manager. Type in libpng in the search box to determine your version (if loaded).

I would also strongly discourage updating the version of libpng that is currently on your system, unless you know what you are doing. For a smooth patch/compile/install, I'd recommend sticking with the installed version.

Aside from our libpng versions (mine was v. 1.4.2) being different, I followed the exact instructions for a successful patch/compile/install.

Thanks again!

Author:  mahvin [ Sun Oct 24, 2010 5:10 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Unfortunately, it's not allowing me to patch libpng on my 64 bit system. Weird!

UPDATE:

Even twice as weird is that on the 64 bit system, the only version it allowed me to patch and compile was 1.4.2, even though it clearly shows libpng version 1.2.42 in Synaptic. Is there another way of checking exactly what version you have, outside of Synaptic? My laptop, which I posted about earlier, showed libpng 1.4.2 in Synaptic, and all went well on that 32 bit system. The desktop (64 bit) was a different story, and a tad confusing. After configuring/compiling/installing version 1.4.2 the APNG plug-in is working fine in GIMP. :yes

Dave's Batch Processor uses the file-png plug-in, and failed to work with the APNG patched version.

Author:  Bob63 [ Fri Oct 29, 2010 10:46 am ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Okay, I've got questions about using this plug-in...

I'm on LinuxMint 9 (Isadora) 32-bit. For those unfamiliar with LinuxMint, it is (was) based on Ubuntu - although they have recently came out with a straight Debian version. My setup has the Gnome desktop, and the current Gimp package is 2.6.8. I successfully patched, compiled and installed the libpng library, and successfully compiled and installed the gimp-apng plug-in.

My question is about converting existing gifs to apng. For gifs I created in Gimp or [Ulead Gif Animator, shh!] I found that I have to convert the gif image from indexed mode to rgb mode. If I don't do this, I get a nearly solid colored apng. Is this normal?

Also, using a random gif downloaded from the Internet, when I try to save it as a apng, I get this error:

libpng error: invalid blend_op in fcTL

I don't understand what this means, exactly, but I'm guessing it would mean that the blending mode used by the creator of the original gif is not compatible with libpng. So it is necessary to do some tweaking somehow. Has anyone tried this? If it was successful I'd like to know how you did it.

Bob

Author:  Rod [ Fri Oct 29, 2010 11:15 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

You should be able to open any GIF in Gimp and save it as a PNG that is animated.
Gimp will then just create a new PNG animation and the GIF will be left intact.
I do not think you can dl and save any GIF as APNG without first opening the layers in Gimp
and then saving as PNG.

Is that what you wanted to know?

Author:  Bob63 [ Sat Oct 30, 2010 1:57 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Well, you confirmed what I thought, but my reality is different. Maybe my libpng is hosed. I did successfully create an apng with a home-made gif - once. every one I have tried since throws out the error I described. I am opening my test gif in Gimp, then re-saving as apng, but it seems that no matter what I do I get the error. (Also, I am making sure that my layers are all the same size, this is a different error.)

Does anybody understand the inner workings of apng + libpng? Does it require a particular blend mode? Since I haven't seen anyone mention it, I'm going to assume that something with my setup is off-kilter.

Author:  gerard82 [ Sat Oct 30, 2010 2:03 pm ]
Post subject:  Re: Compiling Gimp APNG Plug-in using Linux (iibpng-apng-patch)

Hi everyone,
I just installed apng on my amd_64 Gentoo Linux.
Works ok I think,haven't made any animations yet.
Thanks GnuTux,although I run Gentoo your tut on how to install was really helpful.
I noticed some ppl question if it will work in a 64 bit.
Yes it will.
gcc and other software involved will know what to do.
Besides unless these distro's will allow you to make a pure 64 install you will have "multilib".
This means that there are libraries and emulation progs that will take care of 32 bits software.
Adobe Flash's 64 bit progr is a security risk,but the 32 bit is ok.
And there's more software like that.

In the first part of this thread there was a discussion about cross compiling.
A lot of Gentoo users do that.
Gentoo is a source distro which means everything is compiled in the box.
Now if you have 2 or 4 core processor + lots of ram no problem.
But if you want to install it on an old P3 256M ram box then it'll take days to install.
So in that case Gentooers cross compile on a fast box for the P3.
In case your interested take a look at http://www.gentoo.org
Anyone using "mc" AKA Midnight Commander?
Very handy to browse your system etc.
Gerard.

Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/