This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

PSD replace a photo layer resizing issues

Having some issues resizing the photo/image that I am replacing using the following code. It doesn't seem to matter what ResizeMode I choose the results are the same, the image seems to be stretched without regards to the aspect ratio. My understanding is that ResizeMode.ImageFill is supposed to proportionally resize and crop the image, not stretch to fill. It's possible I'm implementing it incorrectly, which is why I am hoping for some feedback. Thanks in advance.

private static MemoryStream ReplacePhoto(MemoryStream preparedStream, PsdProcessor psdProcessor)
{
psdProcessor.FrameCallback = (processor, frame) =>
{
if (frame.Type != FrameType.Raster)
return processor.ProcessFrame(frame);

if (frame.Name == "Photo")
{
// Now the memory stream can be used with ImageReader.Create
using (var background = ImageReader.Create(preparedStream))
{
background.CloseOnDispose = false;
return frame.ToGraphicsContainer(background, ResizeMode.ImageFill);
}
}

return processor.ProcessFrame(frame);
};
return preparedStream;
}
Hi,

Could you post here your PSD and background files?
As soon as I saw your reply I looked at my PSD file and realized I was doing something dumb on my end. My PSD is an 8x10 or 4:5 sized image with a simple overlay over top the image. I was adding in the photo, changing the whole file to a jpg and then squishing it to fit a sheet of 2-5x7s. Obviously a 5x7 is a different ratio from 4:5 and the second process is what was squishing my images down, not Graphics Mill. That was my dumb mistake. Thanks for the response.