JPG to PDF Convertor in C#

Easy with iTextSharp: class Program { static void Main(string[] args) { Document document = new Document(); using (var stream = new FileStream(“test.pdf”, FileMode.Create, FileAccess.Write, FileShare.None)) { PdfWriter.GetInstance(document, stream); document.Open(); using (var imageStream = new FileStream(“test.jpg”, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { var image = Image.GetInstance(imageStream); document.Add(image); } document.Close(); } } }

Convert pdf to jpeg using a free c# solution [closed]

The library pdfiumviewer might be helpful here. It is also available as nuget. Create a new winforms app. Add nuget “PdfiumViewer” to it. This will also add two native dll’s named “pdfium.dll” in folders x86 and x64 to your project. Set “Copy to Output Directory” to “Copy Always”. Try out the following code (change paths … Read more

matplotlib savefig in jpeg format

You can save an image as ‘png’ and use the python imaging library (PIL) to convert this file to ‘jpg’: import Image import matplotlib.pyplot as plt plt.plot(range(10)) plt.savefig(‘testplot.png’) Image.open(‘testplot.png’).save(‘testplot.jpg’,’JPEG’) The original: The JPEG image:

Image resizing and displaying in a JPanel or a JLabel without loss of quality

Of course you can resize the image there are many different ways like Image#getScaledInstance(int width,int height,int hints), but this has its perils. The main problem being: Image.getScaledInstance() does not return a finished, scaled image. It leaves much of the scaling work for a later time when the image pixels are used. I would not recommend … Read more

How to resize NSImage?

Edit: Since this answer is still the accepted answer, but was written without Retina screens in mind, I will straight up link to a better solution further down the thread: Objective-C Swift 4 Because the method of Paresh is totally correct but deprecated since 10.8 I’ll post the working 10.8 code below. All credit to … Read more