I need to automate the task of resizing millions of photos.
The images need 20px cropped off the top and bottom before resizing.
When they are resized down to 200x200 they need to be chopped to a square thumbnail format (this would involve cropping the top or sides of the photo to make the photo square)
I am using windows OS and it is imperative that the directory structure be preserved.
The original files are in JPG format.
My idea is to:
1) Copy all the photos that need resizing to a new SSD drive (preserving directory structure)
2) Crop 20px of the top and bottom
3) Resize and turn into thumbnails of 200x200
4) Save the files as JPEG
5) Rename all the files
6) Copy the files back to the original locations
I have been looking at photoshop automation to crop and resize the photos but it is not suitable for this task.
There are some other batch processing programs, but I need to crop before resize and preserve the dir structure.
We are looking at writing a program to do this ourselves, but just wondering is anybody knows of a command line tool that can do this - especially one that preserves dir structure?
Found ImageMagick that seems to be able to do what i want.
ImageMagick
Now have to figure out how to use it!
Related
I am aware xcode has introduced an option to provide a vector image(.pdf) so that we don't have to give a image for each dimension such as 1x,2x,3x
This saves lots of time and its really a good feature
But how to go about making an vector image in .pdf format.
As far as I know any png image can be saved as .pdf image does it mean it has been vectorized ?
or else we have to do it in the harder way .. by installing adobe illustrator and making an vector image through that
or else it there any web app that does it for us
basically I want to do the right way so the when image is displayed in 3x devices also there is no image distortion
This is a supplement to the excellent answer by #Senseful.
How to make vector images in .pdf format
I will tell how to do this in Inkscape since it is free and open source but other programs should be similar.
In Inkscape:
Create a new project.
Go to File > Document Properties and set the custom page size to whatever your #1x size is (44x44, 100x100, etc) with the units in px.
Make your artwork.
Go to File > Save As... > Printable Document Format (*.pdf) > Save > OK. (Alternatively, you could go to Print > Print to File > Output format: PDF > Print but there are not as many options.)
Notes:
As is mentioned in the accepted answer, you cannot resize your image because Xcode still produces the rasterized images at build time. If you need to resize your image you should make a new .pdf file with a different size.
If you already have an .svg image that is the wrong page size, do the following:
Change the page size (Inkscape > File > Document Properties)
Select all objects (Ctrl+A) on the work space and resize them to fit in the new page size. (Hold down Ctrl to keep aspect size.)
To convert an .svg file into a .pdf you can also find online utilities to do the job for you. Here is one example from this answer. This has the benefit of allowing you to set the .pdf size easily.
Further reading
Using Vector Images in Xcode 6
Original answer
I'm trying to export a PDF with embedded transparent TIFF images. These images have extremely large dimensions. During the embed process, they are shrunk down to fit in the placeholder frames within the target InDesign file. Because of the dramatic decrease in size, when I then export a PDF from the InDesign file I get a halo affect from the anti-aliasing around the edges of the embedded images. I've had some luck reducing the size of the halo by telling InDesign to not down-sample, but I haven't been able to eliminate it. Does anyone know a way to get rid of this artifact?
I have a series of images that I would look to loop through using iOS's [UIView startAnimating]. My trouble is that, when I exported the images, they all came standard in a 240x160 size, although only 50x50 contains the actual image, the rest being transparent parts that are just taking up space.
When I set the frame of the image automatically using image.size.width and image.size.height, iOS takes into images' original size of 240x160, so I am unable to get a frame that conforms to the actual parts of the image. I was wondering if there is a way using Illustrator or Photoshop, or any other graphics editing software for me to export the images based on their natural dimensions, and not a fixed dimension. Thanks!
I am a fan of vector graphics and thinks everything in the world should be vector ;-) so here is what you do in illustrator: file - document setup - edit artboards. Then click on the image, and the artboard should adjust to the exact size. You can of course have multiple artboards, or simply operate with one artboard and however-many images.
My app uses flat graphics, which mostly consists of lines and flat surfaces...
Whats the best approach for building the UI?
use PNG images as much as possible (like for the attached picture, the whole background would be an image)
use 4 UIViews (in this example case) with background color to make the background and the 3 lines
use CoreGraphics to actually draw in drawRect (or somewhere else?)?
subclass UIView and draw PDF content
any other approach?
What are the performance impacts? The advantage of the first two, is that they can be done in IB, but is there a downside (like performance or quality or caching)? I also heard of a trend of using CoreGraphics for drawing all the time...
So basically the fastest way is to use PNG files (stretchable and normal), also if you are using PNG files it will be easy to change the design and fix eventual bugs.
When you are using PNG files, try to reduce the size of the PNGs (stretchable images for backgrounds) for a better performance and a small size of the app.
CoreGraphics is more complex and can add strange bugs or performance problems if you don't know what you are doing, but can be use also for simple view styling.
On every project that I've done I couldn't use only one of these two because of the project complexity or because I was to lazy to open photoshop and add extract some designs.
As H2CO3 said is not that simple. Each format suits particular requirements, there are no written laws, I just ca tell you what I do.
Small pieces of UI, such as buttons, icons etc: I normally use PNG or PDF. You can subclass a UIView to draw PDF vector content. The plus with PDF is that if the source is a vector image, you could not take care about physical-logical points.
Images or Hi-res images, such as image of a content: In this case I use JPG, for they small size respect of PNG. They take little bit more to decompress but usually the size is very smaller compared to PNG.
In general PNG can use alpha, JPG no
Image is a big topic, nowadays I always try a way to find symmetry in UI elements and use stretchable UIImages with PNG.
For you example I will use PNG witch stretchable left and right side. Instead of use 640 px image, you can use 10 px image, with stretchable right margin and stretchable left margin.
[update]
It should be said that if you use stretchable images you will get a lot of performance boost, since the image will be smaller, you will occupy less memory on the "disk", less memory on the heap thatnks to the GPU stretching and less decompressing times
.
I have to create a custom photolib like the default one, with animation etc. I had some doubts..
1. Doubt
Should I create 3 images (Thumbnail image, 320*480 image to display full image and original size image in case user share the image) (I am storing this all in app doc directory)
Or should I only store the original image and crop them wen required in 2 other images? In this case, if I use scroll view to display cropped images, how do I know what the user is seeing? And when do I crop next images to keep them ready to display?
(Can anything like reusable cells be created here like in tableview? If yes, can you give me some idea?)
Also, I am fetching images from doc directory. In this case should I load all images in Array or load in batches?
2. Problem Major:
Also need to compress original image and keep it of same size (I used uijpegrepresentation with compression ratio but with some jpegs after compression. It increases sizes even double the size).
You can use single image and for thumbnail you can Resize at run time else it increase size and performance issue. there is lots of open source library are there which do same what you needed. Please have a look below.
https://github.com/arturgrigor/AGImagePickerController
https://github.com/gdavis/FGallery-iPhone