Hi,
I am developing a program to convert .psd files to .bmp files, using the latest version of Aspose.PSD (25.4).
ProgramAndFiles.zip (1.9 MB)
The file 06-01-1.psd is successfully converted to BMP, but an error occurs with the file 06-01-2.psd.
Aspose.PSD.CoreExceptions.ImageSaveException: 'Image saving failed.'
ImageSaveException: Image export failed.
ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
With Aspose.PSD (23.12), saving to BMP format succeeded for all files.
Can you please help me with this?
Thanks!
@Shinohara
It seems you are encountering an ImageSaveException
when trying to save the file 06-01-2.psd
to BMP format using Aspose.PSD version 25.4. This error indicates that there might be an issue with the data being processed, specifically related to the array bounds.
Here are a few steps you can take to troubleshoot and potentially resolve the issue:
-
Check File Integrity: Ensure that the PSD file 06-01-2.psd
is not corrupted. You can try opening it in a PSD viewer or editor to verify its integrity.
-
Update Aspose.PSD: Since you mentioned that saving to BMP format succeeded with version 23.12, consider checking if there are any updates or patches for version 25.4 that address this issue. Sometimes, newer versions may introduce bugs that are later fixed.
-
Use Stream for Saving: You can try saving the image using a stream, as shown in the example below. This method can sometimes bypass issues related to file handling:
using Aspose.PSD.ImageOptions;
using Aspose.PSD.Sources;
using System.IO;
// Define the path for the output BMP file
string outputPath = "path_to_output_directory/CreatingImageUsingStream_out.bmp";
// Create an instance of BmpOptions and set its properties
BmpOptions bmpOptions = new BmpOptions();
bmpOptions.BitsPerPixel = 24;
// Create a stream for the output file
using (Stream stream = new FileStream(outputPath, FileMode.Create))
{
bmpOptions.Source = new StreamSource(stream, true);
// Create an instance of Image and save it
using (Image image = Image.Create(bmpOptions, 500, 500))
{
// Perform any image processing here if needed
image.Save(outputPath);
}
}
-
Contact Support: If the issue persists, consider reaching out to Aspose support with the specific PSD file that is causing the error. They may be able to provide more detailed insights or fixes.
By following these steps, you should be able to identify the cause of the issue or find a workaround. If you have any further questions or need additional assistance, feel free to ask!
Unfortunately, I couldn’t resolve the issue.
- The PSD file
06-01-2.psd
can be opened with a PSD viewer.
- An error occurred when using the latest version of Aspose.PSD (25.4).
- Saving to a stream also results in an error.
- The specific PSD file is attached to this topic (provided for your reference).
Does the program attached to the topic cause an error in your environment as well?
@Shinohara
I’ll write you back after investigation.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PSDNET-2449
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.