We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MakeGrayscale not working

Hi,


We’re trying to convert the images on our PDF pages to grayscale and then process each page into a JPEG but Page.MakeGrayscale() doesn’t seem to be doing anything to the PDF page or its images - here’s our use case:


var page = pdfDoc.Pages[pageNum];
var jpegDevice = new JpegDevice(width, height, resolution);
var imageString = string.Empty;

using (MemoryStream ms = new MemoryStream())
{
page.MakeGrayscale();// make grayscale
jpegDevice.Process(page, ms);// convert page to JPEG and save in memory stream

imageString = Convert.ToBase64String(ms.ToArray());// get image source string
}

return imageString;


However the images continue to appear in full color… I talked to someone from support and they said it’s known that MakeGrayscale is currently “malfunctioning” - are we using MakeGrayscale incorrectly? Or is the method broken? If it is broken, any idea on an ETA of when it might be fixed?

Thank you,
-Michael

Hi Michael,


Thanks for your inquiry. MakeGrayscale() method is not working as excepted, so we have already logged a ticket PDFNEWNET-16222 in our issue tracking system. We have linked your post to the issue id. You will be notified as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-16222) have been fixed in Aspose.Pdf for .NET 10.6.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

A quick follow up on this issue.


I have updated to the latest version of the pdf library, 10.7.0, but am still having problems with the MakeGrayscale function. Pdf files that I put through are coming out in color, with no noticable change. A code snippet of what I am doing is below and I have before and after pdf files attached.

Thanks in advance for any help you guys can offer.

Jim

Document pdfDocument = new Document(“C:\Users\Desktop\letterFiles\Newfolder\before.pdf”);

for (int i = 1; i <= pdfDocument.Pages.Count; i++)
{
Page page = pdfDocument.Pages[i];

if (page.ColorType == ColorType.Rgb)
{
page.MakeGrayscale();
}
}
pdfDocument.Save(“C:\Users\Desktop\letterFiles\Newfolder\after.pdf”);

Hi Matthew,


Thanks for your inquiry. Please use new code for changing colorspace from RGB to Grayscale, as suggested in following documentation link. However, I have converted your sourced document to Grayscale and noticed that all the elements of PDF document are not converted to Grayscale. So I have logged a ticket PDFNEWNET-39246 for further investigation and resolution. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,

I'm afraid the documentation link didn't make it into your reply, but I found http://www.aspose.com/docs/display/pdfnet/Convert+a+PDF+from+RGB+colorspace+to+Grayscale , which I believe is the page that you were referring to. I updated my code accordingly and have two questions about the output.

The pdf was converted to just two shades, black and white, without any shades of gray in between. This obviously results in a very severe quality impact for any images, and some text as well. Are there any plans to enable conversion to shades of gray, as the name implies?

Despite loading my regular aspose.pdf license file, the converted pdf is still marked with several boxes containing "Evaluation only. Created with Aspose.Imaging". A updated copy of my after.pdf file is attached.

Thanks again for the help

Jim
Hi Jim,

Thanks for your feedback.

jwiegand-1:

I'm afraid the documentation link didn't make it into your reply, but I found http://www.aspose.com/docs/display/pdfnet/Convert+a+PDF+from+RGB+colorspace+to+Grayscale , which I believe is the page that you were referring to. I updated my code accordingly and have two questions about the output.


My apologies, I missed the RGB to GrayScale colorspace conversion documentation link in my above reply. Yes you are right I want to add the mentioned documentation link. Its good to know you find it yourself.

jwiegand-1:

The pdf was converted to just two shades, black and white, without any shades of gray in between. This obviously results in a very severe quality impact for any images, and some text as well. Are there any plans to enable conversion to shades of gray, as the name implies?


Thanks for your findings. We have noticed the issue and logged a ticket PDFNEWNET-39257 for further investigation and rectification.

jwiegand-1:

Despite loading my regular aspose.pdf license file, the converted pdf is still marked with several boxes containing "Evaluation only. Created with Aspose.Imaging". A updated copy of my after.pdf file is attached.

We have already noticed the issue and requested our product team to fix it. We will keep you updated about the issue resolution.

We are sorry for the inconvenience caused.

Best Regards,
Hello

Its been about two months, so I just wanted to check in and see if there are any updates on the status of this issue?

Given that this was originally reported in May and was supposed to be fixed in July with 10.6, I was very disappointed to see that it is still broken as of 10.9. Is there any chance that we might see a fix in 10.10?

We were able to work around this feature being broken in the short term, but that is not an option for us long term. Fairly soon we will be forced to start looking at alternatives.

Thanks

Jim.

jwiegand-1:
Its been about two months, so I just wanted to check in and see if there are any updates on the status of this issue?

Given that this was originally reported in May and was supposed to be fixed in July with 10.6, I was very disappointed to see that it is still broken as of 10.9. Is there any chance that we might see a fix in 10.10?
Hi Jim,

Thanks for your patience.

The first issue reported in this thread was PDFNEWNET-16222 reported on 14May15 and it was fixed in Aspose.Pdf for .NET 10.6.0 release published on 14July15. However later on couple of more issues were reported in the month of August-2015. Please note that issues are resolved in first come first serve basis as we believe its the fairest policy to all the customers. Furthermore, I could not see any post where we have mentioned the timeframe regarding their resolution.

jwiegand-1:
We were able to work around this feature being broken in the short term, but that is not an option for us long term. Fairly soon we will be forced to start looking at alternatives.
We do consider and understand the inconvenience that you have been facing and as soon as we have some definite updates regarding the resolution of these issues, we will update you within this forum thread. Please be patient and spare us little time.

Any update on this issue or ETA as to when these issues will be fixed?


I’ve encountered additional issues with converting PDFs to grayscale as noted in this post: <a href="https://forum.aspose.com/t/25155

The main concern is that it appears to be doing a black and white conversion (rather than grayscale) and that not all background elements and images are getting converted (some remain in color!).

Thanks

Hi Scott,


Thanks for your inquiry. I am afraid above reported issues are still not resolved, as our product team is busy in resolve other issues in the queue, reported earlier. However we have again requested our team to share an ETA asap. We will keep you updated about the issue progress.

Furthermore, we have already noticed your reported issues and logged the issues as following.

PDFNEWNET-39246: All the colored elements are not being converted to grayscale
PDFNEWNET-39257: Conversion is black and white instead grayscale

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNET-39257) have been fixed in Aspose.Pdf for .NET 17.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan