Free Support Forum - aspose.com

EPS to JPEG Conversion Size and Resolution Are Immutable

I’m attempting to use Aspose.Page v20.9 to convert an EPS file to JPEG. I loaded up the HelloWorld example application and started trying some things out. The PostScriptToImage function in the app performs the following:

System::SharedPtrSystem::Drawing::Imaging::ImageFormat imageFormat = System::Drawing::Imaging::ImageFormat::get_Jpeg();
System::SharedPtrSystem::IO::FileStream psStream = System::MakeObjectSystem::IO::FileStream(dataDir() + u"inputForImage.ps", System::IO::FileMode::Open, System::IO::FileAccess::Read);
System::SharedPtr document = System::MakeObject(psStream);
bool suppressErrors = true;
System::SharedPtr options = System::MakeObject(suppressErrors);
System::SharedPtrAspose::Page::EPS::Device::ImageDevice device = System::MakeObjectAspose::Page::EPS::Device::ImageDevice(System::Drawing::Size(595, 842), imageFormat);
document->Save(device, options);

System::ArrayPtr<System::ArrayPtr<uint8_t>> imagesBytes = device->get_ImagesBytes();
int32_t i = 0;
{
for (System::ArrayPtr<uint8_t> imageBytes : imagesBytes)
{
System::String imagePath = System::IO::Path::GetFullPath(outDir() + System::String(u"out_image") + System::Convert::ToString(i) + u".jpg");
{
System::SharedPtrSystem::IO::FileStream fs = System::MakeObjectSystem::IO::FileStream(imagePath, System::IO::FileMode::Create, System::IO::FileAccess::Write);
System::Details::DisposeGuard<1> __dispose_guard_1({ fs });
fs->Write(imageBytes, 0, imageBytes->get_Length());
}
}
}

Using inputForImages.ps from the example app and playing around with the size passed into the device constructor, I found the following:

595,842 gives me a 793 by 1123 pixel output, not sure what to expect here but this seems wrong
1200,1200 gives me a 1600 by 1600 pixel output, I expected 1200x1200 so not sure why it’s larger than I requested

I switched to using the attached “2.eps” file, which is the format I really care about.2.zip (250.0 KB)

I tried the following sizes into the device constructor: 595 x 842, 1200 x 1200, and 400 x 400. In every case, I end up with an output that is 669 x 477. I seem to have no control over the output size.

Also, in every case my outputs are 96 DPI. I’ve combed the documentation but I can’t find a way to change the output resolution for EPS to Image conversion (looks possible for XPS’s API though).

@edebussc

We are looking into the scenario and will get back to you shortly.

@edebussc

An issue has been generated in our issue tracking system as PAGECPP-9 for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.