Re: gtk_pixbuf_save and to jpeg with resolution?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/15/2010 08:18 AM, Tim Corio wrote:
I am saving a jpeg image from a GdkPixbuf using:
gdk_pixbuf_save (pxb, inFile, $gerror, "quality", "100", NULL);

Can I specify a resolution?

I've tried the parameter names "dpi", "resolution", and "Resolution",
but GDK dumps the warning: "(imagemask:21053): GdkPixbuf-WARNING **:
Unrecognized parameter (Resolution) passed to JPEG saver."

Is there a way to set the resolution on a saved image?

Thank You,
Tim

Tim,

I scale the image first to the size I want..


scaled = gdk_pixbuf_scale_simple(pb,
                        size,
                        size * gdk_pixbuf_get_height(pb) /
                        gdk_pixbuf_get_width(pb),                       
                        GDK_INTERP_BILINEAR);

That scales the pb with a width of size and keeps the aspect of the
image for height.

I then save it with

gdk_pixbuf_save(scaled, argv[2], "jpeg", &error,
                "quality", "100", NULL);


Hope that helps,

Kevin

- -- 
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk0I3WgACgkQ6w2kMH0L1dExWwCeIYf2fmCIDfnI41p4cQ29XaeD
oCkAn2BQIwGG/jQ8Nzwk4iXynVTO8aKA
=fjpG
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]