Problems converting a psd

hello, we have a problem converting a psd file into png (psd in attachment - the problem seems to be related to image size 2000x300px)
the resultant png contains a blank border, how we can avoid this behaviour

converting to pdf do not cause this kind of issue

thank you

Hi Valerio,

Thank you for your inquiry and providing sample file.

We have investigated the issue at our end. We are unable to reproduce the issue. Sample code that we used is given below for your reference. Resultant PNG image has also been attached. Please try the code at your end. In case of any issues or you need further assistance, please be sure to let us know.

CODE:

string sourceFileName = @"Imgtest2000x300.psd";

// Create an instance of Image class and load PSD file as image.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(sourceFileName))
{
// Cast image object to PSD image
var psdImage = (Aspose.Imaging.FileFormats.Psd.PsdImage)image;
// Create an instance of PngOptions class
var pngOptions = new PngOptions();
pngOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;
// save to PNG file format.
psdImage.Save(@"Imgtest2000x300_psd.png", pngOptions);
}

sorry, my mistake
actually the problem is conversion from pdf to image
we convert PSD files to pdf and then from generated pdf to images
so the code we use is this
Aspose.Pdf.Devices.Resolution ResolutionP = new Aspose.Pdf.Devices.Resolution(m_iResolution); //120
Aspose.Pdf.Devices.PngDevice PngDeviceP = new Aspose.Pdf.Devices.PngDevice(ResolutionP); PngDeviceP.Process(((Aspose.Pdf.Document)m_oDocument).Pages[++_iPageIndex], _oOutputStream); //page index = the unique pdf page of pdf file

so the pdf generated file is without blank border but the png generated file from pdf has a blank area in the right (i attach the result png file)

Hi Valerio,

Thanks for the details. We are further investigating the issue.

Is not it feasible for you to convert PSD to image directly?

Best Regards,

we tested in some cases (and tiff/psd is one of this) we gain more speed converting from original document to pdf and then from pdf to images: for some documents we use to convert in images and in pdf, for some other like psd we use to convert to pdf and then from pdf to images having 30% average more speed as if we use the first aproach.
moreover the problem of black area happens only with this file with particular dimensions.

Hi Valerio,

Thanks for the details. We are investigating it.

Best Regards,

Hi Valerio,

Can you please also share your complete code (i.e. convert PSD to PDF and then PDF to PNG) and the PDF file generated at your end?

Best Regards,

yes sure

render pdf as image(s)
Aspose.Pdf.Devices.Resolution ResolutionP = new Aspose.Pdf.Devices.Resolution(120);
Aspose.Pdf.Devices.PngDevice PngDeviceP = new Aspose.Pdf.Devices.PngDevice(ResolutionP);
PngDeviceP.Process(((Aspose.Pdf.Document)m_oDocument).Pages[++_iPageIndex], _oOutputStream);



render doc as pdf
Aspose.Imaging.ImageOptions.PngOptions OptionsI = new Aspose.Imaging.ImageOptions.PngOptions();
OptionsI.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;

Aspose.Imaging.ResolutionSetting oResI = new Aspose.Imaging.ResolutionSetting(Convert.ToDouble(120), Convert.ToDouble(120));
OptionsI.ResolutionSettings = oResI;
using (MemoryStream oMTempStream = new MemoryStream())
{
((Aspose.Imaging.Image)m_oDocument).Save(oMTempStream, OptionsI);

Aspose.Pdf.Document oPdf = new Aspose.Pdf.Document();
Aspose.Pdf.Page oPage = oPdf.Pages.Add();

oPage.PageInfo.Width = m_OPageSize.Width;
oPage.PageInfo.Height = m_OPageSize.Height;
oPage.PageInfo.Margin.Bottom = 0;
oPage.PageInfo.Margin.Top = 0;
oPage.PageInfo.Margin.Left = 0;
oPage.PageInfo.Margin.Right = 0;

double dResizeFactor = 0;
double dXsize = 0;
double dYsize = 0;
dResizeFactor = (((Aspose.Imaging.Image)m_oDocument).Width / m_OPageSize.Width > ((Aspose.Imaging.Image)m_oDocument).Height / m_OPageSize.Height) ? ((Aspose.Imaging.Image)m_oDocument).Width / m_OPageSize.Width : ((Aspose.Imaging.Image)m_oDocument).Height / m_OPageSize.Height;
dXsize = ((Aspose.Imaging.Image)m_oDocument).Width / dResizeFactor;
dYsize = ((Aspose.Imaging.Image)m_oDocument).Height / dResizeFactor;

if (((Aspose.Imaging.Image)m_oDocument).Width > ((Aspose.Imaging.Image)m_oDocument).Height)
{

double iW = oPage.PageInfo.Width;
double iH = oPage.PageInfo.Height;
oPage.PageInfo.Width = iH;
oPage.PageInfo.Height = iW;

if ((((Aspose.Imaging.Image)m_oDocument).Width > oPage.PageInfo.Width) && (((Aspose.Imaging.Image)m_oDocument).Height > oPage.PageInfo.Height))
{
oPage.MediaBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
oPage.CropBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
}
else
{
oPage.MediaBox = new Aspose.Pdf.Rectangle(0, 0, ((Aspose.Imaging.Image)m_oDocument).Width, ((Aspose.Imaging.Image)m_oDocument).Height);
oPage.CropBox = new Aspose.Pdf.Rectangle(0, 0, ((Aspose.Imaging.Image)m_oDocument).Width, ((Aspose.Imaging.Image)m_oDocument).Height);
}
}
else
{
if ((((Aspose.Imaging.Image)m_oDocument).Width > oPage.PageInfo.Width) && (((Aspose.Imaging.Image)m_oDocument).Height > oPage.PageInfo.Height))
{
oPage.MediaBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
oPage.CropBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
}
else
{
oPage.PageInfo.Width = ((Aspose.Imaging.Image)m_oDocument).Width;
oPage.PageInfo.Height = ((Aspose.Imaging.Image)m_oDocument).Height;

oPage.MediaBox = new Aspose.Pdf.Rectangle(0, 0, ((Aspose.Imaging.Image)m_oDocument).Width, ((Aspose.Imaging.Image)m_oDocument).Height);
oPage.CropBox = new Aspose.Pdf.Rectangle(0, 0, ((Aspose.Imaging.Image)m_oDocument).Width, ((Aspose.Imaging.Image)m_oDocument).Height);
}
}

Aspose.Pdf.Image oImage = new Aspose.Pdf.Image();

oPage.Paragraphs.Add(oImage);
oImage.ImageStream = new MemoryStream(oMTempStream.ToArray());
oPdf.Save(_oOutputStream);
} //using

Hi Valerio,

Thanks for the details. We will share the updates on this issue soon.

Best Regards,

Hi Valerio,


We are sorry for the delayed response. I have converted your above shared PDF to PNG using Aspose.Pdf for .NET 11.6.0 and unable to notice reported black border. However I have noticed that the converted image has some white space on the right side. I will appreciate it if you please share your image output here, it will help us to address your issue exactly.

Best Regards,

Yes this is the same issue we experience, the extra white space on the right side, as the sample image we share some posts ago
This seems to not to happen when converting PSD to PNG or PSD to PDF but it happens when convert PSD to PDF and then from generated PDF to PNG.

Hi Valerio,

Thanks for the additional information. I have logged an issue in our issue tracking system as PDFNEWNET-40901 to investigate the white space issue and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.
Best Regards,

hello, any news about it?

Hi Valerio,


Thanks for your patience.

As we recently have noticed earlier reported issue PDFNEWNET-40901, so its pending for review and is not yet resolved. However the product team will surely consider investigating/fixing it as per development schedule and as soon as we have some definite updates regarding its resolution, we will let you know. Please be patient and spare us little time. We are sorry for this delay and inconvenience.

hi, any news about it?
thank you

Hi Valerio,


Thanks for your inquiry. I am afraid the issue is still pending for investigation, as product team is busy in resolving other issues in the queue. However we have requested our team to complete the investigation and share an update/ETA as soon as possible. We will notify you as soon as we get a feedback.

Thanks for your patience and cooperation.

Best Regards,

again no news?

Hi Valerio,


We are sorry for the inconvenience. I am afraid the issue is still not resolved as product team was busy in resolving other high priority issues. However, we already raised your issue priority and requested our team to complete the issue investigation and share an ETA at their earliest. We will notify you as soon as we get a feedback.

Thanks for your patience and cooperation.

Best Regards,

once again, any news about it?
such a long time is passed…

Hi Valerio,


Thanks for contacting support.

The product team is working on fixing this issue but I am afraid its not yet resolved. However I have intimated the product team to share the latest updates regarding its resolution and as soon as we have some further updates, we will let you know.

We are sorry for this delay and inconvenience.