Posts Tagged ‘illustrator’

Convincing LatexIt and Illustrator to use the new SIGGRAPH fonts

Saturday, May 20th, 2017

The SIGGRAPH Latex style changed to the Libertine font. Here’re the steps to convince Latexit to use the new stylesheet and then to convince Illustrator to use the libertine font for drag and drop math.

mkdir ~/Library/texmf/tex/latex/local/acmart.cls/
cp ~/Dropbox/boundary/Paper/acmart.cls ~/Library/texmf/tex/latex/local/acmart.cls

In Latexit, open up Preferences, add a new SIGGRAPH “Template” containing:

\documentclass[sigconf, review]{acmart}
\pagenumbering{gobble}

If you try to drag and drop these into illustrator you’ll see that illustrator has replaced the nice math font with Myriad or something silly.

Download the TTF libertine font pack

Drag this into FontBook.app

cp /usr/local/texlive/2015/texmf-dist/fonts/type1/public/libertine/*.pfb ~/Library/Application\ Support/Adobe/Fonts/

Update: I also had to issue:

cp /usr/local/texlive/2015/texmf-dist/fonts/type1/public/txfonts/*.pfb ~/Library/Application\ Support/Adobe/Fonts/
cp /usr/local/texlive/2015/texmf-dist/fonts/type1/public//newtx/*.pfb  ~/Library/Application\ Support/Adobe/Fonts/

If you see boxes with X’s replacing symbols after dragging and dropping from LaTeXit, then drag into Finder instead (to create a .pdf file), then open this directly and Illustrator will give a warning and tell you which font it’s (still) missing.

Restart Adobe Illustrator

Silhouette or outline of a group of shapes in Illustrator

Sunday, January 19th, 2014
  1. Select all of the objects
  2. Group them
  3. Copy and paste them as a new layer
  4. Object > Path > Outline Stroke
  5. Window > Pathfinder, “Unite”
  6. Object > Path > Offset Path
  7. Delete result of “Unite”

    turtle outline

Illustrator error during Object > Path > Outline Stroke

Sunday, January 19th, 2014

I got the following error trying to apply “Outline stroke” to a somewhat complex group on a small (3.33in) artboard.

error dialog

The Operation cannot complete because of an unknown error. [%s]

Error: 0SEG

Well, thanks for that.

My work around was to first scale the group a bunch (after going to “Object > Transform > Scale…” and checking “Scale Strokes & Effects”) and then apply “Outline Stroke”.

Distribute spacing in Illustrator (hidden menu item)

Thursday, January 16th, 2014

I found some sites online talking about the “distribute spacing” function of illustrator (as opposed to the “Distribute Objects” function). However, I could not find it on my “Align” window. The button was missing. Turns out, it’s hidden under “Show options”.

illustrator distribute options

Convert vector graphics “line drawing” (collection of thin filled polygons) to a true line drawing (collection of paths)

Tuesday, September 10th, 2013

Recently, a colleague found a great collection of clip art “line drawing” svgs. For example, this gorilla: gorilla by melwe I use scare quotes because each line is stylized by a thin black polygon. This way each line can have, for example, varying thickness. In illustrator you can open up this svg, select every thing and give the outline stroke a color to highlight this:

illustrator line drawing to paths

If you zoom in on of the pieces you can see clearly that it’s actually a polygon filled with black:

illustrator line drawing to paths

To convert this to a raw collection of paths, first rasterize (dirty I know), by selecting Object > Rasterize... (distinctly not Effect > Rasterize...)

illustrator line drawing to paths

Depending on how detailed your drawing is you may actually have to set the resolution quite low. We want a rough outline after all:

illustrator line drawing to paths

Then click on the rasterized image and select Live trace > Tracing options...

illustrator line drawing to paths

Here is the crucial bit. Uncheck Fill and check Strokes.

illustrator line drawing to paths

This may give you some funny little squiggly lines. I got rid of these by increasing Max Stroke Width, decreasing Min Stroke Length and checking Ignore White.

illustrator line drawing to paths

Finally hit Expand to explode your tracing into the actual curves.

illustrator line drawing to paths

Now that you have paths you can do typical pathy things to them. Like change the stroke width…

illustrator line drawing to paths

Or use a fancy stroke brush …

illustrator line drawing to paths

Postprocess bad transparency pdfs from pdflatex using inkscape

Friday, August 23rd, 2013

I’ve recently renewed my frustration with pdflatex when trying to include pdfs I’ve created in Illustrator with transparency. I finally have a “solution”. Save the following in a file called fixpdftransp.sh:

#!/bin/bash
if [ $# -eq 0 ]
  then
    echo "Usage:"
    echo "  fixpdftransp input.pdf output.pdf"
    return 1
fi

# This is known to work with:
# Included pdfs of compatibility >1.4 
# Inkscape version 0.48.2 r9819 (Jul 15 2011)

# This is known not to work with:
# Included pdfs of compatibility 1.3
# Inkscape 0.48.3.1 r9886 (Aug 23 2013)

INKSCAPE="/Applications/Inkscape.app/Contents/Resources/bin/inkscape"

FORMATIN=".fixpdftransp-%09d.pdf"
FORMATOUT=".fixpdftransp-ink-%09d.pdf"
NUM_PAGES=`pdfinfo $1 | grep Pages: | sed -e "s/ *Pages: *//g"`
LIST=""
for i in $(seq 1 ${NUM_PAGES})
do
  PAGE_NAME_IN=`printf $FORMATIN $i`
  pdftk $1 cat $i output $PAGE_NAME_IN
  echo "Creating $PAGE_NAME_IN"
  PAGE_NAME_OUT=`printf $FORMATOUT $i`
  echo "$INKSCAPE $PAGE_NAME_IN --export-pdf=$PAGE_NAME_OUT"
  $INKSCAPE $PAGE_NAME_IN --export-pdf=$PAGE_NAME_OUT
  LIST="$LIST $PAGE_NAME_OUT"
done
pdftk $LIST cat output $2

Notice you need a specific version of inkscape. I’m using whatever you download from their site today. Notably, this does not work with the inkscape from macports.

Save your included pdfs as PDF 1.4 or higher. Use pdflatex to create a bad pdf and run this on your bad pdf:

./fixpdftransp.sh bad.pdf good.pdf

Update: Though this works on simple pdfs, inkscape seems to screw with the fonts and other images a lot. So, unfortunately resulting pdf is probably not usable.

Transparent gradients in included pdfs using pdflatex lost by Preview.app

Thursday, August 22nd, 2013

I’m running into this issue again. pdflatex on mac os x installed using macports via texlive somehow garbles pdfs with transparent gradients so that they don’t view correctly with Preview.app. The original PDF looks correct with my Preview.app: linear gradient fails with pdflatex on mac with preview

Try compiling a small test document:

\documentclass{article}
\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics[width=\linewidth]{white2green.jpg}
\includegraphics[width=\linewidth]{{{white2green1.7}}}
\includegraphics[width=\linewidth]{{{white2green1.3}}}
\end{figure}
\end{document}

For me the middle image doesn’t show up correctly. Of course the jpg does, but it’s pure raster. The last image is a pdf, but it’s a hacky solution. If you save your pdf with linear gradients in Illustrator as Compatibility: Acrobat 4 (PDF 1.3) then Illustrator will raster your transparency. It does a halfway decent job and it seems that the pdf is forward compatible: you can still edit it in Illustrator as vector graphics.

Vector field with actual arrows

Sunday, August 11th, 2013

I recently discovered MATLAB’s quiver function which produces visualizations of vector fields. This function creates “arrows” using three line segments. This is fine for prototyping, but not great for making nice images.

Here’s an example using quiver:


[X,Y] = meshgrid(linspace(0,1,40),linspace(0,1,40));
U = sin(X*2*pi).*sin(Y*2*pi)+X;
V = sin(X*2*pi).*cos(Y*2*pi);
quiver(X,Y,U,V);
set(gca,'Visible','off')
set(gcf,'color','w')

which produces:
quiver plot of trig function

Here’s my updated pipeline for making nice images of vector field using MATLAB and Adobe Illustrator.

In Matlab:


% scale appropriately
s = 1e-1;
% plot just lines
plot([X(:) X(:)+s*U(:)]',[Y(:) Y(:)+s*V(:)]','-b');
set(gca,'Visible','off')
set(gcf,'color','w')

which produces:
plot of trig function as lines

Save this as an .eps file and open it with illustrator.

Inevitably, matlab will have saved much more than just the line segments. Clean it up a bit. Select one of the “dot” markers (especially visible if any of your lines were very small). Then choose Select > Same > Stroke Weight. This will select all dots. Then hit Delete.

Now select one of the line segments and choose Select > Same > Stroke Weight. This will select all line segments. Now choose an appropriate arrowhead. This will produce something like:
arrows for vector field in illustrator

Extract full resolution image from PDF using Illustrator and Photoshop

Tuesday, July 12th, 2011

I had the problem that when kinkos scanned my artwork they gave me a PDF. This doesn’t make a whole lot of sense because the scan is a raster image. It’d be much better off in PNG or in many cases JPG. I tried just opening the PDF in Preview or Photoshop and saving as a PNG but when prompted for the resolution I wasn’t sure what to put. What was the resolution of the PDF? And what was the resolution of the embedded image? Then I tried opening the PDF in illustrator, selecting the image and pasting it as raw pixels into a new photoshop document. This didn’t work either since the image was embedded into the PDF in a scaled form so the copied image was too small. My final solution is as follows:

In illustrator

  1. Select the image object
  2. Open View > Document Info > Embedded Objects
  3. Record the size of the image
  4. Copy the selected image

In Photoshop

  1. Create a new document (this will be the correct dimensions of the copied object, but perhaps the wrong resolution)
  2. Paste the object, but as a Smart Object
  3. Choose Image > Image size…
  4. Enter the size of the image, previously recorded
  5. Choose Layer > Flatten Image

Update: As suggested in the comments it’s much easier to use pdfimages to extract embedded images. I made a follow up post which does this then uses imagemagick’s mogrify to convert the files to pngs.

Update: Also, (see the comments), this is not even the easiest way to a get a single image from a pdf into photoshop.

Hide spill over when thick line meets up with thin line corner in illustrator

Friday, May 13th, 2011

There are at least two ways to prevent the sort of spill over that happens in illustrator when you have a thick line meeting up at the corner of a thin path:
thick line in corner wrong
First, you can select the thin line path and add an extra stroke which will hide the spill over. Do these by choosing Appearance > Add New Stroke then change the color of the new stroke to the background color and make the stroke width large enough to hide the spillover. In the stroke dialog be sure to choose Align stroke to outside:
add extra stroke to hide-spill.png

The other way is to make a copy of the thin line path and then select the copy and the thick line and choose Object > Clipping Mask > Make. You’ll probably have to rearrange the layers so that your original thin line path come out on top.

Both produce a nice result:
thick line in corner correct