[PATCH] OpenRaster: optimize PNG saving

ForumsFor GIMP developers (read-only) ► [PATCH] OpenRaster: optimize PNG saving

Sent: 2010-02-27 15:14:34 UTC (almost 2 years ago)

From: Jon Nordby

[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)

--
1.7.0

--
Regards Jon Nordby - www.jonnor.com

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-03-06 15:27:30 UTC (almost 2 years ago)

From: Martin Nordholts

[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

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-03-06 16:35:14 UTC (almost 2 years ago)

From: Sven Neumann

[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

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-03-06 19:04:10 UTC (almost 2 years ago)

From: Liam R E Quin

[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

--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-03-12 23:09:06 UTC (almost 2 years ago)

From: Jon Nordby

[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.

--
Regards Jon Nordby - www.jonnor.com

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-03-13 12:23:25 UTC (almost 2 years ago)

From: Martin Nordholts

[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

--

My GIMP Blog:
http://www.chromecode.com/
"Multi-column dock windows and 2.8 schedule"
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Welcome!


Lost password?

Not a member? Sign up!

Random tutorials | Latest tutorials

  1. Hot Wallpaper with Flames Hot Wallpaper with Flames 52
  2. Creating an abstract chaos explosion Creating an abstract chaos explosion 10
  3. Create a simple Grunge-Stamp! Create a simple Grunge-Stamp! 7
  4. Ashes to ashes, dust to dust. Dissolve text into particles Ashes to ashes, dust to dust. Dissolve text into particles 3

Latest comments

2.6.12 crashes on startup in windows xp. 2.6.11 works fine. (2 days ago in Last stable 2.6 release: 2.6.12 has arrived)

Thank you! You really helped! The tutorial went great for me! Tha... (5 days ago in [AVATAR] Become a real Na'Vi using GIMP!)

maybe you still selected a channel or so? explicitly click a layer ... (5 days ago in Create cool rifts with translucent lights!)

Poll

Is GIMP an adequate application for you to create printed graphics like flyers, advertisments etc?

Latest forum activities

Your Ad Here

facts & numbers

gimpusers.com RSS feed

48 identi.ca followers
749 Twitter followers

powered by bitfire it services