Free Support Forum - aspose.com

Convert transparent tif image to transparent image with resize


#1

Is there supported to resize transparent tif image to transparent tif image?
I am working with locally but it couldn’t work for me


#2

@rupal,

Can you please share your requirements in form of sample along with sample code so that we may further investigate to help you out.


#3

Just want to save tif image with tranparent,

Input file : BILCMV00024-DTG-COLOUR-BLK.tif with transparent
outputfile: 123.tif but it becomes with white background that i dont want, it doesn’t maintain transparency

Can you please help us,

String dataDir = Utils.getSharedDataDir(SupportTiffDeflate.class) + “ManipulatingTIFFImages/”;

		String outputFileTiff = "D:/Working/123.tiff";
		TiffFrame frame=new TiffFrame("C:/Users/rupal-pc/Desktop/BILCMV00024-DTG-COLOUR-BLK.tif");
		 TiffImage image=new TiffImage(frame) ;
		 image.setBackgroundColor(false);
		 image.setTransparentColor(true);
		
		try
		{
		TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffDeflateRgba);
		image.save(outputFileTiff, options);
		}
		finally
		{
		image.dispose();
		}

#4

@rupal,

Can you please check and make sure that you have attached source file properly. I have not observed any file attached to this thread.


#5

Please consider the following code, there is no attachment
String outputFileTiff = “D:/Working/123.tiff”;
TiffFrame frame=new TiffFrame(“C:/Users/rupal-pc/Desktop/BILCMV00024-DTG-COLOUR-BLK.tif”);
TiffImage image=new TiffImage(frame) ;
image.setBackgroundColor(false);
image.setTransparentColor(true);

	try
	{
	TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffDeflateRgba);
	image.save(outputFileTiff, options);
	}
	finally
	{
	image.dispose();
	}

#6

@rupal,

I have worked with source code shared by you. For further investigation can you please share source tiff file that you used on your so that i may investigate and log ticket to help you out or provide workaround for this.


#7

Here it is, Please try with ASAP


#8

@rupal,

I suggest you to please try using following sample code on your end to serve the purpose.

public static void TestTiffTransparent()
{
    String path = "C:\\Imaging Data\\TIFF_Images\\";
//    TiffFrame frame = new TiffFrame(path + "BILAAV00063.tif");
    TiffFrame frame = new TiffFrame(path + "BILAAV00244.tif");

    TiffImage image=new TiffImage(frame) ;
    PngOptions OptionsIM = new PngOptions();
    OptionsIM.ColorType = com.aspose.imaging.fileformats.png.PngColorType.TruecolorWithAlpha;
    //OptionsIM.TransparentColor = new Aspose.Imaging.TransparentColorSetting(Aspose.Imaging.Color.Transparent);
    ResolutionSetting oResIM = new ResolutionSetting(120f, 120f);
    OptionsIM.ResolutionSettings = oResIM;
    image.save(path + "BILAAV00244.tif.png", OptionsIM);

}

#9

Thanks for reply,
I have worked with this code but getting same problem with transparency.
Need same transparency as per original image but output is with white background and also not managed multilayered quality in output file

is it providing us with transparency for multilayered tif image as per given images with attachment in above reply…

Thanks,


#10

@rupal,

Can you please share generated result along with environment details so that we may further investigate to help you out.


#11

If we give input tif file with transparency than output must be .tif ext. with same transparency
Here i have mentioned the code:

public static void TestTiffTransparent()
{
String path = “E:\OrderScanner\OriginalImages\”;
// TiffFrame frame = new TiffFrame(path + “BILAAV00063.tif”);
TiffFrame frame = new TiffFrame(path + “actual.tif”);

    TiffImage image=new TiffImage(frame) ;
    PngOptions OptionsIM = new PngOptions();
   // OptionsIM.ColorType = com.aspose.imaging.fileformats.png.PngColorType.TruecolorWithAlpha;
    OptionsIM.setColorType(com.aspose.imaging.fileformats.png.PngColorType.TruecolorWithAlpha) ;
    //OptionsIM.TransparentColor = new Aspose.Imaging.TransparentColorSetting(Aspose.Imaging.Color.Transparent);
    ResolutionSetting oResIM = new ResolutionSetting(120f, 120f);
   // OptionsIM.ResolutionSettings = oResIM;
    OptionsIM.setResolutionSettings(oResIM);
    image.save(path + "SIlver_DOG1111111.png", OptionsIM);

}

Below link having both images original and generated


#12

@rupal,

We have further investigated the requirement on our end. An issue with ID IMAGINGNET-3338 has been created in our issue tracking system to resolve the issue of preserving the transparency of Tiff while converting to PNG. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#13

Yes, Please try to solve this issue as soon as possible and also there should be maintained transparency while transparent.tif to .tif


#14

@rupal,

We will update you as soon as the issue will be fixed.