| T O P I C    R E V I E W | 
               
              
                | guillem | 
                Posted - Jun 09 2014 : 05:13:33  Is it possible to save a Tiff image with TRANSPARENT background and with CMYK colorspace? that's my code:
  Img1.IO.Params.TIFF_PhotometInterpret := ioTIFF_CMYK;
  and 
  Img1.IO.Params.TIFF_PhotometInterpret := ioTIFF_TRANSPMASK;
  Is there something like: 
  Img1.IO.Params.TIFF_PhotometInterpret := ioTIFF_TRANSPMASK or ioTIFF_CMYK; | 
               
              
                | 3   L A T E S T    R E P L I E S    (Newest First) | 
               
              
                | guillem | 
                Posted - Jun 10 2014 : 06:23:53  Hello all, Here is another unsuccessful aproach.
  The code below generates two output files (a tiff and a png file). The PNG file it is transparent with the content I desire. The TIFF file contains the contents I desire with cmyk format but it is not transparent.
  One again if I use: Img1.IO.Params.TIFF_PhotometInterpret := ioTIFF_TRANSPMASK; It generates the TIF file transparent but with not cmyk format.
 
 
  It is really possible to generate cmyk TIF files with a transparent background?
  Can anyone help?
  Thank you very much Guillem.
 
 
  //  SOURCE CODE
  Img1.IO.Params.TIFF_Compression := ioTIFF_LZW; Img1.IO.Params.TIFF_PhotometInterpret := ioTIFF_CMYK; Img1.IEBitmap.PixelFormat := ieCMYK;
  Img1.EnableAlphaChannel := true; Img1.IEBitmap.Width := w; Img1.IEBitmap.Height := h;
  Img1.AlphaChannel.Fill(0);
  Img1.LayersAdd; Img1.Layers[0].PosX := 0; Img1.Layers[1].PosY := 0; Img1.Layers[1].Width := w div 2; Img1.Layers[1].Height := h div 2;
  Img2.SelectionBase := iesbBitmap; Img2.SelectEllipse(x,y,w,h, iespReplace); Img2.IEBitmap.CopyWithMask1(Img1.Layers[1].bitmap, Img2.SelectionMask);         Img1.DeSelect; Img1.LayersFixRotations(1); Img1.Layers[1].Locked := true; Img1.LayersMerge(0,1,true); Img1.Fit; Img1.Refresh;
  Img1.IO.Update;
 
  Img1.IO.SaveToFileTIFF(sTif_filename); Img1.IO.SaveToFilePNG(sPNG_filename);
 
  | 
               
              
                | guillem | 
                Posted - Jun 10 2014 : 02:56:18  Hi Nigel, Thanks for your fast response.
  I have been doing some tests and I cannot generate a tif file with cmyk colors and transparent background.
  I am loading a tif file into img2 and then I copy  a selected part of img2 into img1. what i want to achive is to save a new tif file (img1) with a transparent background and a part of img2 content with cmyk colors. What i get now with this code is exactly what i need except the transparent background. You can see I do loads of unnecessary things with the alphachannel property, but I do that to try to get part of the tif file transparent.  
  If you or anyone can help with that I will really apreciate it. Or can you provide a really simple sample code of a transparent tif file with cmyk colors?
  Thanks in advance.
  What am i doing wrong? Here is my code:
 
           Img2.IO.Params.TIFF_PhotometInterpret := ioTIFF_CMYK;          Img2.IO.LoadFromFileTIFF(sFilename);          Img2.IO.Update;
 
           w := Img2.IO.Params.Width;          h := Img2.IO.Params.Height;          x := w div 2;          y := h div 2;
 
 
           Img1.IO.Params.TIFF_Compression := ioTIFF_LZW;          Img1.IO.Params.TIFF_ImageDescription := Extractfilepath(sTiff);          Img1.IO.Params.TIFF_PhotometInterpret := ioTIFF_CMYK;
           Img1.EnableAlphaChannel := true;          Img1.IEBitmap.Width := w;          Img1.IEBitmap.Height := h;
 
           Img1.AlphaChannel.Fill(0);           Img1.AlphaChannel.Canvas.Pen.Color := clBlack;          Img1.AlphaChannel.Canvas.Brush.Color := clBlack;
           Img1.AlphaChannel.Canvas.FillRect(myRect);          Img1.AlphaChannel.Canvas.Pen.Color := clwhite;          Img1.AlphaChannel.Canvas.Brush.Color := clwhite;          Img1.AlphaChannel.Canvas.Ellipse(200,200,700, 700);
           Img1.Select(200,200,600,600);          Img1.SetSelectedAreaAlpha(140);
           Img2.SelectionBase := iesbBitmap;          Img2.SelectEllipse(x,y,w,h, iespReplace);          Img2.IEBitmap.CopyWithMask1(Img1.IEBitmap, Img2.SelectionMask);
           Img1.SelectEllipse(x,y,w,h, iespReplace);          Img1.SetSelectedAreaAlpha(100);          Img1.Select(200,200,600,600);          Img1.SetSelectedAreaAlpha(50);
           Img1.IO.Update;
           Img1.IO.SaveToFileTIFF(sFilename1);
 
  | 
               
              
                | xequte | 
                Posted - Jun 09 2014 : 14:23:10  Hi
  TIFF_PhotometInterpret simply exposes the PhotometricInterpretation tag of the TIFF standard:
  http://www.fileformat.info/format/tiff/corion.htm http://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
  So only one value can be specified.
 
  However if you want to have transparent background on a TIFF that is possible even if TIFF_PhotometInterpret = ioTIFF_CMYK. You must add an Alpha channel to your image. Please see the Alpha Channel section of TImageEnView:
  http://www.imageen.com/help/TImageEnView.html
 
 
  Nigel  Xequte Software www.xequte.com nigel@xequte.com | 
               
             
           | 
         
       
       
     |