Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

theprizerevealed

macrumors regular
Original poster
Feb 26, 2016
183
12
I wish to know if there is a native tool on macOS mojave to convert png files to a higher resolution suitable for ipad pro third generation. There are many files and so I'm searching for a program that can process numerous files automatically.

If not, is there something available on the Apple app store that might do the trick? I don't wish to use relatively unknown third party tools because of privacy reasons. thanks
 
The 'sips' command is usable in Terminal, a shell script, or in a Run Shell Script step of an Automator workflow.

Here's the man page:
https://ss64.com/osx/sips.html

You'll want the --resampleHeightWidthMax option if you want to preserve aspect ratio.

You can also read the man page in Terminal with:
Code:
man sips


If you use Automator, it has some image resizing actions (Scale Images) that don't need a shell script. As it turns out, they run 'sips' to perform their task.
 
well, unfortunately this does not appear to do what I wish it to do. Using this command:

Code:
for i in *.png; do sips -s format jpeg -s formatOptions 100 "${i}" --out "${i%png}jpg"; done

It converts all of the png files in the folder to jpeg just fine. However when I check the dots per inch when I open an image file in Preview and use the Inspector to check the number - the dpi remains the same for the corresponding jpeg file as it was for the png file!

I need some program that can increase the resolution (isn't that the dot per inch?).
 
As I understand DPI for JPEG files, it's a suggestion intended for printing, roughly speaking. There are articles explaining more that show up by googling: jpeg file dpi


To change the number of pixels, which is what I think you're asking for, use one of the:
--resampleXXX
operations. If you're increasing the dimensions, then you'll get pixelation if the increase is significant.

If the images have different sizes, then you can use 'sips' to read pixelHeight or pixelWidth first, put that number into a shell var, then calculate a new value by multiplying it in a $(( arithmetic expression )) in bash, then use that new value in a --resampleXXX operation.
 
Thanks, however many of these files have widely varying aspect ratios (lengths of heights and widths). I don't wish to set a standard height and width - simply to increase the number of pixels for greater definition, clarity and resolution.
 
You can't really make the resolution of an image greater than it is. You can make the image bigger but the information in the image will be the same. iOS doesn't care about dpi. That's only a suggestion anyway. iOS will pick the best match from among the three images provided with a particular name. So on a 3x screen it will prefer the @3x image. If there is none it will use the @2x image. And if that's not available it will pick the 1x image.

So you can choose to ignore the @3x images if you don't have them and iOS will display the 2x image and scale it for you. Or you can convert the 1x or 2x images to the 3x size. It's just a matter of the image dimensions. So a 100x100 1x image would have a 200x200 @2x image and 300x300 @3x image to match it.

In general png is preferred over jpg because png is lossless while jpg loses pixels when compressed.

The apps most used for image manipulation for iOS are Photoshop and Sketch, AFAIK.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.