File size increased when Grayscale

new_sample_1-10_20231012040814386.pdf (3.7 MB)

Hi,

We are using the below mentioned snippet for Grayscale conversion and compression. We have tried with a 3.7MB file, after grayscale conversion the file size has increased to 29MB and then after compression it got reduced to 7.4MB which is double the size of the original file. Kindly validate and confirm the same.

Grayscale Conversion:
using (Aspose.Pdf.Document document = new Aspose.Pdf.Document(SourceFilePath + Filename))
{
Aspose.Pdf.RgbToDeviceGrayConversionStrategy strategy = new Aspose.Pdf.RgbToDeviceGrayConversionStrategy();
for (int idxPage = 1; idxPage <= document.Pages.Count; idxPage++)
{
// Get instance of particular page inside PDF
Page page = document.Pages[idxPage];
try
{
// Convert the RGB colorspace image to GrayScale colorspace
strategy.Convert(page);
}
catch (Exception ex)
{
WriteErrorLog("ConverttoGrayscalePDF Exception - " + " - " + ex);
continue;
}
}
// Save resultant file
document.Save(convertfilename);
document.Dispose();
}

Compression:
using (Aspose.Pdf.Document doc2 = new Aspose.Pdf.Document(convertfilename))
{
var optimizationOptions = new Aspose.Pdf.Optimization.OptimizationOptions();
optimizationOptions.RemoveUnusedObjects = true;
optimizationOptions.RemoveUnusedStreams = true;
optimizationOptions.AllowReusePageContent = true;
optimizationOptions.LinkDuplcateStreams = true;
optimizationOptions.UnembedFonts = true;
optimizationOptions.ImageCompressionOptions.CompressImages = true;
optimizationOptions.ImageCompressionOptions.ImageQuality = 50;
optimizationOptions.ImageCompressionOptions.ResizeImages = true;
optimizationOptions.ImageCompressionOptions.Version = Aspose.Pdf.Optimization.ImageCompressionVersion.Fast;
optimizationOptions.ImageCompressionOptions.MaxResolution = 200;
doc2.OptimizeResources(optimizationOptions);
doc2.Save(Source);
doc2.Dispose();
}

@Aswin0892
The issue is reproduced in our environment.
Thank you for writing to us.
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): PDFNET-55674

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.

For Issue (PDFNET-55674) - Do you know when a fix will be available?

@eNoahAdmin
We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue.
We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

We will inform you via this forum thread once there is an update available on it.

Is there any update on this issue??

@Aswin0892
Nothing new for this task yet. Created tasks are solved in the order they are received, taking into account priorities.
The highest priority is for tasks with paid support, followed by tasks from users who have purchased a license.
The time it takes to solve problems can also vary. Therefore, unfortunately, it is not even possible to give ETA.