• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Photoshop Script Black and White Raster to Vector

Community Expert ,
Nov 10, 2014 Nov 10, 2014

Copy link to clipboard

Copied

I do not have AI Adobe for I do not want to spend the money and have to learn an other complex Adobe application. I'm no artist either.  However at rimes I wanted  to have AI live trace feature to change black and white line drawing into vector graphics. AI creates EPS files with embedded vectors. And can export the vector to Photoshop.  Though Photoshop opens EPS as raster layers I find that EPS file created from tracing black and white lines and artwork with programs like potrace that use curves to create black vector shapes. That when these are opened in Photoshop as Black layer with transparency. When these layers transparency are loaded as a selection and the selections converted to path. I find the path are extremely good.

Potrace is a cross platform open source program packages available for many operating systems. Windows (32 bit) and (64 bit), Mac OS X (Intel), Mac OS X (universal),Linux (32 bit) and (64 bit), Linux (Alpha), Linux (Sparc64), Sun Solaris (Sparc), Sun Solaris (i386), Sun Solaris (x86_64), FreeBSD (i386), NetBSD (i386), OpenBSD (i386), AIX and AROS (i386). Potrace is a command line command. So it can be use started with options and passed a file from bat files and scripts. Potrace requires No instillation. All the needed potrace requited files just need to be place into a folder and potrace run from that folder as the current directory.

So a created a Photoshop script that more or less uses potrace like a Photoshop Plug. The script define a custom shape for the current active document using potrace and add a new shape layer using the new defined custom shape as the top layer. The script also toggle off the other visible layers so you just see the shape layer.  You can use alt click on the shape layer visibility icon to toggle the other layer visibility so you can see how well it matches the document.

I'm a windows user so the Photoshop script I wrote though in javascript will most likely only run on a windows platform because of my use of windows features its command line start command and file system conventions. I'm quite sure a Mac variant could created. Here is screen capture showing how well the defile shape  matches up and a link to the script. You would need to download potrace to use it and fix the vars in the script that point to potrace. http://www.mouseprints.net/old/dpr/potrace.jsx

Capture.jpg

Clipboard1.jpg

JJMack
TOPICS
Actions and scripting

Views

3.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Feb 02, 2016 Feb 02, 2016

Copy link to clipboard

Copied

I updated the script some time ago. The Script now expects the potrace.exe to be in the same folder that the potrace.jsx file is in.  So on a Windows system, you would need to copy the two files into your Photoshop version folder Presets\Scripts\ I use windows and the script uses windows conventions.  The developer of potrace made versions of potrace available  for many platforms. It should be possible to make a version of my script that will work on a Mac.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 04, 2017 Jun 04, 2017

Copy link to clipboard

Copied

Hey JJMack, I was poking around Google on the off chance I might be able to convert strokes to vector paths the way Illustrator does, but in Photoshop. Stumbled across this, and BOOM, exactly what I was looking for! Brilliant! Much thanks for that fantastic script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2017 Jun 04, 2017

Copy link to clipboard

Copied

LATEST

It would be even better if Photoshop supported SVG files well.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines