[gimp] file-jpeg: Fix load/save for different precisions
- From: Mukund Sivaraman <muks src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] file-jpeg: Fix load/save for different precisions
- Date: Tue, 14 May 2013 08:06:00 +0000 (UTC)
commit 0ae7894f8705d550d0483d7da0ea3ea7eaf186ee
Author: Mukund Sivaraman <muks banu com>
Date: Tue May 14 13:35:47 2013 +0530
file-jpeg: Fix load/save for different precisions
plug-ins/file-jpeg/jpeg-load.c | 5 +++--
plug-ins/file-jpeg/jpeg-save.c | 11 +++++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index 873e3a4..be8fd40 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -234,8 +234,9 @@ load_image (const gchar *filename,
}
else
{
- image_ID = gimp_image_new (cinfo.output_width, cinfo.output_height,
- image_type);
+ image_ID = gimp_image_new_with_precision
+ (cinfo.output_width, cinfo.output_height,
+ image_type, GIMP_PRECISION_U8);
gimp_image_undo_disable (image_ID);
gimp_image_set_filename (image_ID, filename);
diff --git a/plug-ins/file-jpeg/jpeg-save.c b/plug-ins/file-jpeg/jpeg-save.c
index e55e194..0e84a6d 100644
--- a/plug-ins/file-jpeg/jpeg-save.c
+++ b/plug-ins/file-jpeg/jpeg-save.c
@@ -86,6 +86,7 @@ typedef struct
guchar *data;
guchar *src;
GeglBuffer *buffer;
+ const Babl *format;
const gchar *file_name;
gboolean abort_me;
guint source_id;
@@ -235,7 +236,7 @@ background_jpeg_save (PreviewPersistent *pp)
pp->cinfo.image_width,
(yend - pp->cinfo.next_scanline)),
1.0,
- NULL,
+ pp->format,
pp->data,
GEGL_AUTO_ROWSTRIDE,
GEGL_ABYSS_NONE);
@@ -271,6 +272,7 @@ save_image (const gchar *filename,
{
GimpImageType drawable_type;
GeglBuffer *buffer = NULL;
+ const Babl *format;
GimpParasite *parasite;
static struct jpeg_compress_struct cinfo;
static struct my_error_mgr jerr;
@@ -345,24 +347,28 @@ save_image (const gchar *filename,
/* # of color components per pixel */
cinfo.input_components = 3;
has_alpha = FALSE;
+ format = babl_format ("R'G'B' u8");
break;
case GIMP_GRAY_IMAGE:
/* # of color components per pixel */
cinfo.input_components = 1;
has_alpha = FALSE;
+ format = babl_format ("Y' u8");
break;
case GIMP_RGBA_IMAGE:
/* # of color components per pixel (minus the GIMP alpha channel) */
cinfo.input_components = 4 - 1;
has_alpha = TRUE;
+ format = babl_format ("R'G'B'A u8");
break;
case GIMP_GRAYA_IMAGE:
/* # of color components per pixel (minus the GIMP alpha channel) */
cinfo.input_components = 2 - 1;
has_alpha = TRUE;
+ format = babl_format ("Y'A u8");
break;
case GIMP_INDEXED_IMAGE:
@@ -684,6 +690,7 @@ save_image (const gchar *filename,
pp->temp = temp;
pp->data = data;
pp->buffer = buffer;
+ pp->format = format;
pp->src = NULL;
pp->file_name = filename;
pp->abort_me = FALSE;
@@ -714,7 +721,7 @@ save_image (const gchar *filename,
cinfo.image_width,
(yend - cinfo.next_scanline)),
1.0,
- NULL,
+ format,
data,
GEGL_AUTO_ROWSTRIDE,
GEGL_ABYSS_NONE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]