Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread Michael Natterer
On Fri, 2012-12-07 at 12:57 +0400, Oleg wrote:
   Hi, all.
 
   Gimp already can open multipage tiff as multilayer image, but it can't save
 it correctly. I didn't see gimp code, but it seems not hard to write 
 something,
 that we already can read.
   What can help to resolve this problem?

The only thing that helps is writing a patch :)

Regards,
--Mitch


___
gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list


Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread Simon Budig
Oleg (lego12...@yandex.ru) wrote:
 On Fri, Dec 07, 2012 at 10:15:58AM +0100, Michael Natterer wrote:
  The only thing that helps is writing a patch :)
 
   Of course :-), but i just think about some donation that can help with
 an intrest in the tiff saving. Is this possible?

It is possible to donate to Gimp and we promise that it will help with
the development of the Gimp (mainly by financing face to face meetings
of gimp developers and relevant projects).

However, we do not want to have feature-specific donation: This would
hamper our independance and would make it harder to reject bad ideas
from the outside.

Of course tiff multipage saving is not really a bad idea - don't get me
wrong there - but we really would prefer a patch over money.

Thanks,
Simon
-- 
  si...@budig.de  http://simon.budig.de/
___
gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list


Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread scl

Hi,

it seems we already have a patch:
https://bugzilla.gnome.org/show_bug.cgi?id=335975
It only needs to be tested and integrated.

Kind regards,

Sven

___
gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list


Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread Oleg
On Fri, Dec 07, 2012 at 11:07:33AM +0100, scl wrote:
 Hi,
 
 it seems we already have a patch:
 https://bugzilla.gnome.org/show_bug.cgi?id=335975
 It only needs to be tested and integrated.

  Wow! This is great! Thanks a lot.
  I've adopted this patch to gimp 2.6 from debian squeeze source package. May
be this is useful for anybody.
  Why this patch is not in the mainstream yet?
___
gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list


Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread Oleg
On Fri, Dec 07, 2012 at 11:07:33AM +0100, scl wrote:
 Hi,
 
 it seems we already have a patch:
 https://bugzilla.gnome.org/show_bug.cgi?id=335975
 It only needs to be tested and integrated.

  Wow! This is great! Thanks a lot.
  I've adopted this patch to gimp 2.6 from debian squeeze source package. May
be this is useful for anybody.
  Why this patch is not in the mainstream yet?

P.S. Forgot the patch--- gimp-2.6.10.old/plug-ins/common/file-tiff-save.c	2010-07-03 02:51:56.0 +0400
+++ gimp-2.6.10/plug-ins/common/file-tiff-save.c.2	2012-12-07 16:12:21.0 +0400
@@ -75,12 +75,16 @@
 #define SAVE2_PROC file-tiff-save2
 #define PLUG_IN_BINARY file-tiff-save
 
+#define LAYER_MODE_MERGE   0
+#define LAYER_MODE_COMBINE 1
+#define LAYER_MODE_PAGES   2
 
 typedef struct
 {
   gint  compression;
   gint  fillorder;
   gboolean  save_transp_pixels;
+  gshortlayer_mode;
 } TiffSaveVals;
 
 typedef struct
@@ -254,7 +258,8 @@
   (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
-   GIMP_EXPORT_CAN_HANDLE_ALPHA ));
+   GIMP_EXPORT_CAN_HANDLE_ALPHA |
+   GIMP_EXPORT_CAN_HANDLE_LAYERS ));
   if (export == GIMP_EXPORT_CANCEL)
 {
   values[0].data.d_status = GIMP_PDB_CANCEL;
@@ -286,6 +291,7 @@
 
   tsvals.compression= pvals-compression;
   tsvals.save_transp_pixels = pvals-save_transp_pixels;
+  tsvals.layer_mode = pvals-layer_mode;
 }
   gimp_parasite_free (parasite);
 
@@ -333,6 +339,7 @@
 
   tsvals.compression= pvals-compression;
   tsvals.save_transp_pixels = pvals-save_transp_pixels;
+  tsvals.layer_mode = pvals-layer_mode;
 }
   gimp_parasite_free (parasite);
   break;
@@ -643,25 +650,28 @@
   gushortextra_samples[1];
   gboolean   alpha;
   gshort predictor;
-  gshort photometric;
+  gshort photometric = 0;
   gshort samplesperpixel;
   gshort bitspersample;
   gint   bytesperrow;
-  guchar*t, *src, *data;
+  guchar*t, *src, *data = NULL;
   guchar*cmap;
-  gint   colors;
+  gint   num_colors;
   gint   success;
-  GimpDrawable  *drawable;
+  GimpDrawable  *drawable = NULL;
   GimpImageType  drawable_type;
   GimpPixelRgn   pixel_rgn;
   gint   tile_height;
   gint   y, yend;
-  gint   fd;
   gboolean   is_bw= FALSE;
   gboolean   invert   = TRUE;
   const guchar   bw_map[] = { 0, 0, 0, 255, 255, 255 };
   const guchar   wb_map[] = { 255, 255, 255, 0, 0, 0 };
 
+  gint32	*layers;
+  gint		nlayers;
+  gint		layerIndex;
+
   compression = tsvals.compression;
 
   /* Disabled because this isn't in older releases of libtiff, and it
@@ -675,17 +685,7 @@
   tile_height = gimp_tile_height ();
   rowsperstrip = tile_height;
 
-  fd = g_open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
-
-  if (fd == -1)
-{
-  g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
-   _(Could not open '%s' for writing: %s),
-   gimp_filename_to_utf8 (filename), g_strerror (errno));
-  return FALSE;
-}
-
-  tif = TIFFFdOpen (fd, filename, w);
+  tif = TIFFOpen(filename, w);
 
   TIFFSetWarningHandler (tiff_warning);
   TIFFSetErrorHandler (tiff_error);
@@ -693,187 +693,6 @@
   gimp_progress_init_printf (_(Saving '%s'),
  gimp_filename_to_utf8 (filename));
 
-  drawable = gimp_drawable_get (layer);
-  drawable_type = gimp_drawable_type (layer);
-  gimp_pixel_rgn_init (pixel_rgn, drawable,
-   0, 0, drawable-width, drawable-height, FALSE, FALSE);
-
-  cols = drawable-width;
-  rows = drawable-height;
-
-  gimp_tile_cache_ntiles (1 + drawable-width / gimp_tile_width ());
-
-  switch (drawable_type)
-{
-case GIMP_RGB_IMAGE:
-  predictor   = 2;
-  samplesperpixel = 3;
-  bitspersample   = 8;
-  photometric = PHOTOMETRIC_RGB;
-  bytesperrow = cols * 3;
-  alpha   = FALSE;
-  break;
-
-case GIMP_GRAY_IMAGE:
-  samplesperpixel = 1;
-  bitspersample   = 8;
-  photometric = PHOTOMETRIC_MINISBLACK;
-  bytesperrow = cols;
-  alpha   = FALSE;
-  break;
-
-case GIMP_RGBA_IMAGE:
-  predictor   = 2;
-  samplesperpixel = 4;
-  bitspersample   = 8;
-  photometric = PHOTOMETRIC_RGB;
-  bytesperrow = cols * 4;
-  alpha   = TRUE;
-  break;
-
-case GIMP_GRAYA_IMAGE:
-  samplesperpixel = 2;
-  bitspersample   = 8;
-  photometric = PHOTOMETRIC_MINISBLACK;
-  bytesperrow 

Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread scl

On 07.12.12 at 2:06 PM Oleg wrote:

On Fri, Dec 07, 2012 at 11:07:33AM +0100, scl wrote:

Hi,

it seems we already have a patch:
https://bugzilla.gnome.org/show_bug.cgi?id=335975
It only needs to be tested and integrated.


   Wow! This is great! Thanks a lot.
   I've adopted this patch to gimp 2.6 from debian squeeze source package. May
be this is useful for anybody.
   Why this patch is not in the mainstream yet?


I don't know. Perhaps it's not tested enough?
To let this patch and your efforts be a benefit for all, can you please 
test the patch and report at the aforementioned Bugzilla page about the 
results.



P.S. Forgot the patch


Please don't attach files larger than 10 KB to mails for the mailing 
list, because there are at least 1000 subscribers here ;-)

More information about contributing patches can be found at
http://developer.gimp.org/faq.html#id461957. Nevertheless thank you.

Kind regards,

Sven

___
gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list


Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread Partha Bagchi
This patch will not work with the current master and if I am not mistaken,
a cursory glance says that it won't save 16-bit tiffs and hence would have
to be modified.

Sorry.



On Fri, Dec 7, 2012 at 9:29 AM, Oleg lego12...@yandex.ru wrote:

 On Fri, Dec 07, 2012 at 03:01:10PM +0100, scl wrote:
  On 07.12.12 at 2:06 PM Oleg wrote:
  On Fri, Dec 07, 2012 at 11:07:33AM +0100, scl wrote:
  Hi,
  
  it seems we already have a patch:
  https://bugzilla.gnome.org/show_bug.cgi?id=335975
  It only needs to be tested and integrated.
  
 Wow! This is great! Thanks a lot.
 I've adopted this patch to gimp 2.6 from debian squeeze source
 package. May
  be this is useful for anybody.
 Why this patch is not in the mainstream yet?
 
  I don't know. Perhaps it's not tested enough?
  To let this patch and your efforts be a benefit for all, can you
  please test the patch and report at the aforementioned Bugzilla page
  about the results.

   I have already successfuly saved multipage tiff. How else can i test this
 patch?

 P.S. I've tested it against gimp 2.6. Is this ok?

  P.S. Forgot the patch
 
  Please don't attach files larger than 10 KB to mails for the mailing
  list, because there are at least 1000 subscribers here ;-)

   Ups. Sorry. I didn't know this.

 ___
 gimp-developer-list mailing list
 gimp-developer-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gimp-developer-list

___
gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list


Re: [Gimp-developer] gimp multipage tiff

2012-12-07 Thread Oleg
On Fri, Dec 07, 2012 at 09:55:22AM -0500, Partha Bagchi wrote:
 This patch will not work with the current master and if I am not mistaken,
 a cursory glance says that it won't save 16-bit tiffs and hence would have
 to be modified.
 
 Sorry.

  How can i test this?
  I've successfully saved tiff with RGB color mode (is this 16-bit image?),
greyscale and indexed color modes. I've just got error, when i tried to save
layers with alpha channel:

TIFF save cannot handle indexed images with alpha channel.

but i don't know is this a bug or a feature :-).
___
gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list