[PATCH] OpenRaster: optimize PNG saving
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
[PATCH] OpenRaster: optimize PNG saving | Jon Nordby | 27 Feb 15:14 |
[PATCH] OpenRaster: optimize PNG saving | Martin Nordholts | 06 Mar 15:27 |
[PATCH] OpenRaster: optimize PNG saving | Sven Neumann | 06 Mar 16:35 |
[PATCH] OpenRaster: optimize PNG saving | Liam R E Quin | 06 Mar 19:04 |
[PATCH] OpenRaster: optimize PNG saving | Jon Nordby | 12 Mar 23:09 |
[PATCH] OpenRaster: optimize PNG saving | Martin Nordholts | 13 Mar 12:23 |
[PATCH] OpenRaster: optimize PNG saving
From 0e41e65f31ae07c91f2ed5dc8f0c51d05949be51 Mon Sep 17 00:00:00 2001
From: Jon Nordby
Date: Sat, 27 Feb 2010 14:28:58 +0100
Subject: [PATCH] OpenRaster: optimize PNG saving
Sets lower compression and disables interlacing.
On a 5 layer image of 4500x6000px this gives an order of magnitude better
save-times, with 50% increase in file size.
---
plug-ins/pygimp/plug-ins/file-openraster.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/plug-ins/pygimp/plug-ins/file-openraster.py
b/plug-ins/pygimp/plug-ins/file-openraster.py
index 2016c2b..eeefe13 100755
--- a/plug-ins/pygimp/plug-ins/file-openraster.py
+++ b/plug-ins/pygimp/plug-ins/file-openraster.py
@@ -85,7 +85,7 @@ def save_ora(img, drawable, filename, raw_filename):
def store_layer(img, drawable, path):
tmp = os.path.join(tempdir, 'tmp.png')
- pdb['file-png-save-defaults'](img, drawable, tmp, 'tmp.png')
+ pdb['file-png-save'](img, drawable, tmp, 'tmp.png', 0, 2, 1, 1, 1, 1, 1)
orafile.write(tmp, path)
os.remove(tmp)
[PATCH] OpenRaster: optimize PNG saving
On 02/27/2010 03:14 PM, Jon Nordby wrote:
Sets lower compression and disables interlacing. On a 5 layer image of 4500x6000px this gives an order of magnitude better save-times, with 50% increase in file size.
Hi Jon
Sorry for the late follow-up and thanks for maintaining the ORA plug-in.
50% increase in file size is pretty significant, maybe the compression ratio should be exposed in a UI?
@@ -85,7 +85,7 @@ def save_ora(img, drawable, filename, raw_filename):
def store_layer(img, drawable, path): tmp = os.path.join(tempdir, 'tmp.png') - pdb['file-png-save-defaults'](img, drawable, tmp, 'tmp.png') + pdb['file-png-save'](img, drawable, tmp, 'tmp.png', 0, 2, 1, 1, 1, 1, 1)
It would be nice to make 0, 2, 1, 1, 1, 1, 1 immediately interpretable, for example by commenting or using local variables like so:
embed_profile = 1
function(1, # save_comment
embed_profile)
BR, Martin
[PATCH] OpenRaster: optimize PNG saving
On Sat, 2010-03-06 at 15:30 +0100, Martin Nordholts wrote:
On 02/27/2010 03:14 PM, Jon Nordby wrote:
Sets lower compression and disables interlacing. On a 5 layer image of 4500x6000px this gives an order of magnitude better save-times, with 50% increase in file size.
Hi Jon
Sorry for the late follow-up and thanks for maintaining the ORA plug-in.
50% increase in file size is pretty significant, maybe the compression ratio should be exposed in a UI?
IMO 50% increase in file size is not much for a file format that is meant for archival and exchange of images. It's not that people are likely to use OpenRaster files on web-pages or the like. Being able to save quickly seems much more important than file-size here.
Sven
[PATCH] OpenRaster: optimize PNG saving
On Sat, 2010-03-06 at 16:35 +0100, Sven Neumann wrote: [...]
IMO 50% increase in file size is not much for a file format that is meant for archival and exchange of images.
Archival - it'd mean an extra 20 gigabytes to back up for one of my "old books" archives for example. Interchange - the difference between 100 megabytes and 150 megabytes for an image seems at the least noticeable to me, and that's for an 8bit per channel grayscale image. (I'd be using 16 bits if the tools I had supported it a little better)
It's not that people are
likely to use OpenRaster files on web-pages or the like. Being able to save quickly seems much more important than file-size here.
I don't mind waiting 10 minutes to save a file for archiving, especially as GIMP lets me do other things in the meantime.
My vote here is for exposing it in the UI, as with export to PNG, as it's clearly different for different people.
Liam
[PATCH] OpenRaster: optimize PNG saving
On Sat, Mar 6, 2010 at 3:30 PM, Martin Nordholts wrote:
On 02/27/2010 03:14 PM, Jon Nordby wrote:
Sets lower compression and disables interlacing. On a 5 layer image of 4500x6000px this gives an order of magnitude better save-times, with 50% increase in file size.
Hi Jon
Sorry for the late follow-up and thanks for maintaining the ORA plug-in.
50% increase in file size is pretty significant, maybe the compression ratio should be exposed in a UI?
First some absolute numbers (rough measurements) so we don't get lost in
relative figures.
Saving said image on a 2Ghz core2duo with enough memory too keep it from
swapping yields:
xcf - 150MB - under 10 seconds
xcf.gz - 65MB - about 23 seconds
ora, before patch (maximum compression) - 48MB - about 7 minutes
ora, after patch - 63MB - about 30 seconds
Do you really think there it is a big point to introduce a UI for selecting
compression?
In my experience, the predominant usecase for OpenRaster seems to be for
interchange between different applications when working locally. And for
that I don't see the point.
@@ -85,7 +85,7 @@ def save_ora(img, drawable, filename, raw_filename):
def store_layer(img, drawable, path): tmp = os.path.join(tempdir, 'tmp.png') - pdb['file-png-save-defaults'](img, drawable, tmp, 'tmp.png') + pdb['file-png-save'](img, drawable, tmp, 'tmp.png', 0, 2, 1, 1, 1, 1,
1)
It would be nice to make 0, 2, 1, 1, 1, 1, 1 immediately interpretable, for example by commenting or using local variables like so:
embed_profile = 1 function(1, # save_comment
embed_profile)
You are right. Attached patch addresses this.
[PATCH] OpenRaster: optimize PNG saving
On 03/12/2010 11:09 PM, Jon Nordby wrote:
Do you really think there it is a big point to introduce a UI for selecting compression?
Nah maybe not.
It would be nice to make 0, 2, 1, 1, 1, 1, 1 immediately interpretable, for example by commenting or using local variables like so:
embed_profile = 1 function(1, # save_comment
embed_profile)You are right. Attached patch addresses this.
Thanks, much better, I've pushed the commit now:
commit 614714d980b906ec8ee049d1f6ea90681640c07a
Author: Jon Nordby
Date: Fri Mar 12 23:01:24 2010 +0100
plug-ins: Optimize OpenRaster PNG saving
Sets lower compression and disables interlacing.
On a 5 layer image of 4500x6000px this gives an order of magnitude
better
save-times, with 50% increase in file size.
/ Martin