GIMP scripting: can a batch process be interactive? - gimp

I have a folder of images from which I need to make 60x60pixel thumbnails. The originals are of mixed sizes, and I'd like to be able to select which portion of each image to use for the thumbnail. Is there a way to automate this with Gimp scripting?
I imagine the sequence to be as follows:
1. Wait for user to specify source folder.
2. Open first image.
3. Wait for user to select part of the image
(with fixed 1:1 aspect ratio)
(... how does the user tell the script to continue?)
4. Crop to selection.
5. Resize image to 60x60.
6. Apply sharpen filter (some fixed settings for this are ok).
7. Save image.
8. Open next image (if any) and repeat from step 3 above.
Ideally, everything except steps 1 & 3 would be automated. Is this possible? If so, some tips on how to get started would be much appreciated. Thanks.

Related

Webmatrix - webimage crop then resize

I want to make sure that all the images that users upload to my website are the same size.
The size that I want to achieve is 620px x 405px
Because I don't want any white space in my images, and I want to keep the aspect ratio, I'm guessing I'll need to crop first, before I resize?
So far I've got the following code:
photo.Resize(width: 620, height:405, preserveAspectRatio: false, preventEnlarge: true);
But obviously this isn't giving me the desired affect.
I have seen other articles online where they do some formula, but I can't get any to work for me.
Suppose someone uploads an image which is 1020 wide by 405? Which bit do you want to keep? The left hand end? Right hand end? The middle bit? Then the next image is 3000 x 3000. Now which bit do you want to crop? Perhaps this one needs resizing before cropping otherwise you might only get a window.
My recommendation is to allow the user to specify the crop area, and then you resize the resulting cropped image. There are a number of jQuery plugins that enable client side cropping. I've written about jCrop (http://www.mikesdotnetting.com/Article/161/WebMatrix-Testing-the-WebImage-Helper-With-JCrop) but I have also received some feedback that it is not reliable in some versions of IE (although I haven't tested that myself).

How can I generate iOS code to draw an image?

How can I consume a graphic and then generate objective-c code that can draw it? The code generation doesn't need to be written in objective-c, but must generate objective-c code.
Input: A.png
Output: Core Graphics code to generate a file A.png that would match the image of the original file, A.png.
For example, since I can find out the color and position of every pixel, what tool can I use to write iOS code that draws those pixels exactly.
Why inflate the bundle size with images or why wait to pull down images from a web service when the app itself could generate those images with the right instructions.
My intention is to use this in a white label solution.
Why inflate the bundle size with images or why wait to pull down images from a web service when the app itself could generate those images with the right instructions
Because your code will still need to contain all the information contained in the image, plus all those drawing instructions, so you're going to end up with a larger product, not a smaller one. Additionally, building the image data into the code makes it that much harder to change.
Use PaintCode to create your graphics.
You are done.

How to update an app comprised entirely of images for the iPhone 5

I need to update an app which was written for the iPhone 4 screen size to work on the iPhone 5. I have read on SO about AutoLayout and so on, but the problem is that each screen in this app is made up of a background image, which then has touchable areas and such drawn on in code. These are positioned absolutely. This isn't the way I would have designed the app, but it's the task I am faced with.
I have two problems to solve:
1) How do I load the correct background image. Do I need to create a separate image size for each and them in code query the device size each time an image is loaded? To give some context, there are well over 100 images.
2) How do I maintain the touchable areas. Is it best to just add the required number of pixels to the bottom of the app? Would this then work, or will I need to query device size and change coords accordingly every time I draw something?
Thank you,
Sam
Autolayout will work in the device is running iOS 6 or higer.
1) Yes you will need a image larger image for all the images in your app. You could overload some methods in a base class to make this more easy to load the correct image.
An other option is to stretch the image, but this is up to you.
2) I would adjust my coordinates to the size of the device.
If Apple would add an other screen size you will run in the same problem again. You should try and create an interface that can grow with the screen.

Custom PhotoLibrary, and jpeg compression

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

Automate Saving for iPhone images in Photoshop

I have a dream script I'm looking for and wondering if anyone here as stumbled across one
Problem: Creating #2x and regular PNG files for iOS software
Edit: no need to worry about file type. iOS images should ALWAYS be 24bit PNG
In my workflow, I'll get my image all set then go through this same exact ritual every time:
Save for Web & Devices
Press Save and choose a filename, like "myimage#2x.png"
Save for Web & Devices again
Reduce image size by 50%
Press Save and choose a similar filename like "myimage.png"
My dream photoshop script would
1. Ask for a filename & location: i.e. present a typical save dialog
2. I'd enter a name "myimage"
3. it would save the current document as "myimage#2x" in that location, and then save a 50% reduced image named "myimage" also in that location
Any ideas? I've poked around the photoshop scripting reference but its a bit overwhelming.
Thanks!!
You could use photoshop Actions for that. You can found dozens of how-tos for that in google.
But i rather prefer to save all images just in retina with #2x and then load them all in the little and smart app called unretiner (Appstore link) to generate the lowers images.
Here is an action set I created (JLRetinaPNGExport.atn) which you can find here. This action set comes with 3 actions:
current layer export as .png at 100% then 50%
current layer, trim transparent pixels, then export as .png at 100% then 50%
merge visible and export as .png at 100% then 50%
This action set was modified from this action set. Hope this helps!

Resources