Wednesday, December 14, 2011

Unscaling pasted images

In the past few releases of the CS suite, I've found that when I paste an image from the windows clipboard into Illustrator, the pasted image size is reduced to about 70%.  I hope there is just some setting that can turn this off, but being the lazy programmer that I am, I just wrote a couple lines of code to knock the imported graphic back to 100%.

This script can be run on multiple selected items at a time, and will only affect Raster Items.
If the selected item is already at 100% it will not be transformed.

Enjoy,
-J

3 comments:

John said...

When I started doing this I multiplied the width and height by a fixed number, but then I noticed the transform matrix was distorted, so now I just reassign the scaling to 1, and the image scales to pixel perfection.

Fruityth1ng said...

I had this happen to me in photoshop, too.
I turned out that in these cases one of the images (the one pasted, or pasted into) had a DPI other than 72 set.

I solved it with an "on load" script in photoshop, setting all my images to 72 DPI (And another one converting the background of single layer images to a layer - but that's off topic)

Was this the case with yours, too?

John said...

Hey, thanks for the note FruityTh1ng. I checked, and sadly, no, the issue with illustrator does not appear to be document dpi. The images I am pasting are 72dpi, and the target document is also 72 dpi.

I even checked 'document raster effects', and that too was 72. I don't get why it's happening, but I'm glad to have found such an easy fix.
Note, that since I'm just resetting the transform to 1x scale, this may break on documents with different dpi settings. I haven't tested it yet.