U P D A T E

See our 2016 update
Solving That Adobe Generator Problem -- Again
for a very simple, permanent solution to this issue.

Photo Corners headlinesarchivemikepasini.com


A   S C R A P B O O K   O F   S O L U T I O N S   F O R   T H E   P H O T O G R A P H E R

Enhancing the enjoyment of taking pictures with news that matters, features that entertain and images that delight. Published frequently.

Solving A Photoshop Generator Problem Share This on LinkedIn   Share This on Google   Tweet This   Forward This

29 July 2014

Last September Adobe introduced Generator on the File menu of the v14.1 release of Photoshop CC. In the Photoshop.com blog entry announcing the new feature, Stephen Nielson wrote:

Generator allows you to create image assets in real time as you work, eliminating the tedious steps of copying, slicing and exporting each layer manually, and saving you hours of time. Simply add a file extension to the name of your layer or layer group, and Photoshop will automatically create a JPG, PNG or GIF from the contents of that layer. If you make a change to that layer, the file is immediately updated. This means that you now have a folder of images that are always up-to-date with your Photoshop design.

You have to turn on the feature using the Generate command from the File menu by checking Image Assets (shown Off, the default, below). Then as you work on a layer, the layer is written to a folder named with the document name and "-assets" append to it.

Generate. On the File menu, enable Image Assets.

This happens in the background as you work until you unclick Image Asset under Generator.

You can annotate the layer name to include image size and quality settings, too. So "200 percent logo-retina.png, logo.png" produces both a 2x and a 1x asset and "heroImage.jpg10" produces a 1x asset with max quality.

Here's a video explaining the entire process:

If you do Web design, this is pretty helpful stuff. But it also has its photographic applications, too, since you can automatically build various thumbnails with it.

For example, if we wanted three versions of our background image, we could create them with three names in that layer:

  • A full-size JPEG would be created with "background.jpg"
  • A half-size JPEG would be created with "50% bg.jpg" (make sure you use a different name)
  • A specific-size PNG would be created with "300x418 s-bg.png"

You get all three at once by naming the layer "background.jpg, 50% bg.jpg, 300x418 s-bg.jpg" -- that's all there is to it.

If you make a mistake, a text file named "errors.txt" will appear in the directory to explain what you did wrong.

Example Document. Our Photoshop CC 2014 example document, showing what the final design looks like..

In our example document above, we've created several layers to illustrate this:

Document Layers. Detail of Photoshop layers.

  • The photo is the background layer, which is named background.jpg. We'll only want the one JPEG for this demonstration.
  • Above it we have a type layer with a double name of type.gif and type.jpg so both image files will be generated. The JPEG is set for an image quality of 10 or 100 percent, the maximum. This layer also has a drop shadow on it.
  • On top we have another text layer automatically named "SAN FRANCISCO." Until we rename it, it won't be exported as an asset. Later, after we changed the name of the layer to "location.gif," a GIF of the text was exported to the asset folder, as you can see below:

Assets Folder. A Photo Mechanic view of the asset folder named for the image file.

This magic comes to Photoshop via Node.js, a version of which is built into the application. You can also grab the source code on GitHub, where you can learn more about the possible annotations.

A PROBLEM

Recently, after installing a new plug-in, we launched Photoshop CC 2014 only to be greeted by a Generator error message:

There is a problem with Generator. Please quit Photoshop and try again. If the problem persists, remove any third-party plug-ins or try reinstalling Photoshop.

We quit and restarted. Same error.

We moved our plug-ins out of Photoshop CC 2014's plug-in folder. Same error.

We launched Photoshop CC and got the same error.

We uninstalled Photoshop CC 2014 and reinstalled it. Same error.

Finally we emailed the plug-in tech support guys. And it puzzled them, too.

They wanted to peek at our error logs but to our consternation, we had no error log for Photoshop.

What was going on?

OPTIONS

On the game show Who Wants to Be a Millionaire?, contestants had three options when they didn't know an answer:

  • They could select 50-50 to remove two of the four possibilities, improving their odds from a 25 to 50 percent chance to get it right.
  • They could call a friend.
  • They could ask the audience.

In real life, when you're stumped, you only get the last two. And the worst thing you can do is call a friend. Unless you are trying to trim down your Christmas list.

The best thing to do is ask the audience, or in more current parlance, Google it. So that's what we did.

HOW TO GOOGLE

It may seem silly but it's been our experience that nobody is very good at using Google or any other search engine. They think they are asking a friend and try to be as smart about their question as possible.

Actually, the dumber the query, the better the results. Google is not a friend you have to impress. It's just trying to make a match on what you feed it.

So searching requires no sophistication whatsoever. Select the error message and paste it into the search box. No need to be cute.

That returned some results. Among the more helpful was one on the Adobe forums in which Adobe employee Anirudh Sasikumar identified the path name where Photoshop Generator writes logs.

So now we knew where our error log should be. But that's all our searching managed to tell us.

SLEUTHING

It was time for some real sleuthing.

It can be hard to remember what you did before you noticed the problem. And therefore it can be impossible to trace. But it shouldn't be too hard to repeat.

What you need is a little feedback during the re-enactment. And Console in Mac OS gives you that. Event Viewer is the Windows equivalent.

Console. The Generator log after things were working.

These applications look over your shoulder and tell you what kind of trouble your computer is having. Console listens to both the operating system and the application, showing your their logs in real time.

So we opened Console and watched as Photoshop launched and repeated the Generator error message. In the "All Messages" section, Console reported:

7/24/14 8:16:30.823 PM [0x0-0x1221220].com.adobe.Photoshop: at process.handleUncaughtException (/Applications/Adobe Photoshop CC 2014/Adobe Photoshop CC 2014.app/Contents/Required/Generator-builtin/lib/stdlog.js:48:23)

We asked the audience about "process.handleUncaughtException" and found an entry on N V Harikrishna's blog. He remarked, "Whenever node sees a uncaught exception, by default it will terminate. As usual this is not acceptable in production environments. Process should keep on running and handle such exceptions gracefully." He provided a code snippet to do just that.

So Node.js was failing to do something (can you guess what?) and we were getting the same old graceful Photoshop error message each time.

We launched Photoshop but then tried to enable Image Assets using the Generate command. Looking through "All Messages" in Console again, we came across this:

7/24/14 9:15:55.082 PM [0x0-0x125d25c].com.adobe.Photoshop: [Error: EACCES, permission denied '/Users/mrpasini/Library/Logs/Adobe/Adobe Photoshop CC']

That's the same place Sasifumar said the log should be. So the problem was that Node.js didn't have permission to create that log directory.

Why not? We would have to do a little investigation.

The enclosing Adobe folder has the same permissions as other folders there (Get Info displays the permissions at the bottom of its window), so we manually created the folder with the same, correct permissions.

We had permission to do that.

When we relaunched Photoshop CC 2014, we did not get the dialog warning there's a problem with Generator and we were able to open our test document above with apppropriately named layers. When we enabled Image Assets, Photoshop generated the assets immediately.

The permissions problem explains why Photoshop CC had a problem, too. It would also have been unable to create that directory.

QUESTIONS

Nice as it was to resolve the issue, it left us with the puzzle of what had happened.

We'll never know but it wouldn't be the first time some installation routine changed permissions on some enclosing folder and didn't revert them to what they should be. It helps to have Disk Utility repair permissions for system files after installations to avoid this.

We did that after the fact and saw the usual warnings about printer drivers, some disturbing ones about iTunes and a few others. All fixed.

We probably should have done that and then tried to let Photoshop create the log folder rather than creating the folder ourselves. But we were still diagnosing, not fixing things.

THE LESSON

This is really a story about diagnostics. Everybody has problems but calling a friend is the least likely way to solve a problem. It may be the easiest approach (let George do it, as we used to say), but this isn't the time to put your feet up and order an iced tea.

The best place to start is by Googling the error message and reading through the hits. File some away in your memory for reference.

Then -- and this is the real lesson -- check the error logs (in our case with Console). If there's nothing in the application's log, look at the system messages that are being generated. If you get confused, recreate the problem and monitor the logs as they are being written.

You may not understand the log entries you find but you can still Google them. It often takes just a hint, not even a clue, to get you back in business.


Comments

Thank you so much for this article. It helped me to solve that problem that I have tried to fix for two weeks. It is disappointing that Adobe support can't propose a solution themselves.

-- Benoit Etienne

You're welcome! -- Mike


BackBack to Photo Corners