So, I've been working on and off for a while on a Photoshop script that
builds photo-realistic fake matting around images. The script is not done
yet, but I'll present what I have in the hopes it's helpful to someone, and
that perhaps I can get some good feedback for improvements.

Let me say up front that the process is a bit complex, somewhat out of
necessity because I want very good results, but also because I haven't done
the work to wrap the script up in a tidy hand-holding user interface.

If
you're not comfortable editing a script file with a text editor, this post
is not for you

If you'd like something more automated, consider a commercial product,
such as John Hartman's pricy ($239) but automated Quick Mats. I've not
tried it, but the samples seem promising.

Also up front: I've tested this on Photoshop CS5. I don't know whether it works on earlier versions.

If you just want to play with a sample PSD created by this script, you can
download this 28-megabyte sample-mat.zip, which contains
one PSD: A4 size @ 250DPI with one opening at a 1½-inch margin, and John Hancock's signature.

That's the whole point... it's easy to make a fake-looking fake
mat, but my script builds a result that incorporates many little visual
cues to make a result that looks real when printed on a high-quality
printer and displayed on the wall, even when inspected fairly closely.

Full-Resolution Cropof an example to be printed at 250 DPI

( but on a computer screen, this is likely much larger than life size )

Perhaps most importantly, the surface of the mat
comes from an actual photograph of the surface of an actual mat, so when displayed
at the proper resolution, it will be a true “actual size” representation of
an actual physical mat.

Note: as discussed below, the photos on this post are
necessarily displayed on your monitor at an incorrect resolution for accurate true-life sizing,
so they'll all look less “natural” to an extent that depends on the specific monitor you're viewing this post on.I wish, of course, that I could show them
properly on screen, but it's not technically feasible; however, in the end
it doesn't really matter because these are intended to be printed,
not viewed on screen.

Anyway, at the moment I have just four separate mat surfaces that have been
prepared well enough to give a try at one resolution, but eventually I want
to re-do them under higher-quality conditions. You can see the other
surfaces in the next examples...

two mats of different thicknesses and material
my pattern #2 is on top of the photo, pattern #3 is on top of that

this is pattern #1 again

pattern #4 laid over pattern #2

A photo-realistic mat surface alone is a start, but it's not enough...
other subtle visual cues the brain would expect in a physical mat are
required. If done well, most people would hopefully not consciously notice
these visual cues, but I'll mention them here...

For example, the edges where the mat is cut have a very slight
raggedness that matches the surface of the mat. As for the cut surfaces
themselves (that is, the thin inside portion of the mat exposed when the
opening is cut), their size, shape, and shading are all dependent on an
intended eye location and light location configured when you build the mat.
The same intended light location also influences how a subtle shadow of the
mat is cast onto the photo.

The inside of the mat exposed at the edges of an opening is not perfectly
smooth, but slightly textured, as in real life. The thin edge in each
corner where two cuts meet has a slight shading that doesn't seem to make
much sense to me in theory, but I see it in real mats, so I include it
here.

Easy to Adjust Mat Colors For a Specific Photo

This'll be discussed more in the section about the Photoshop document
that the script produces, but the most important aesthetic decision of a mat
— real or fake — is its color. In the final Photoshop document,
you use the normal Photoshop color picker to select the mat color, which
means you can just drag an eye-dropper around an image to try colors,
perhaps also adjusting saturation or brightness.

Customizable

The script allows you to adjust for the paper size and the specific
nature of the printer and paper to be used, the number of mats, their
thicknesses, their surface texture and color, the angle of the beveled
knife cuts used to make each opening, and the size and location of however
many openings you want.

Because this script is for something that will be printed and placed on
the wall, you can add important visual 3D cues to the mat cuts by
incorporating the viewing location into the shape calculations. Because
viewing such a result from the wrong position would look decidingly wonky,
you'd want to use this feature only if you know that the print will tend to
be viewed from a known general location. (For example, the
prints hanging in my office are normally seen while sitting in my
office chair.)

Some things are customizable after the mat document has been generated,
so that you can adjust them to suit the specific photo you're dropping in.
Most important is the color of the mat, which you can pluck from the photo
with the eye dropper, but you can also control aspects of the lighting and
shading, how pronounced or subtle the mat texture should be, etc.

Specific

The results of the script are intended to be printed on the specific
printer in the specific way the script is configured for. You can, of
course, generate general-purpose mat documents, but you can eke out
more quality when being specific.

Example at 128 DPI
displays actual size on my laptop monitor

Specific DPI

The pattern on the surface of the mat is intended to be printed at a
specific DPI. If you print or display at a different resolution, it will
end up being scaled in one way or the other (expanded or shrunk), after
which it may no longer look real. For example, the mats in the sample
photos at the top of this post don't look particularly real: they've been
shrunk down to ¼ of their original pixel size to fit in this post,
and then expanded by the fact that the originals were intended to be
displayed at 250 DPI, but they're being viewed on your computer monitor
which likely has a DPI somewhere in the 70-150 range.

Since everyone's monitor setup is different, it's not possible to
display an “actual size” example on a blog post... the “250 DPI
full-resolution crop” above is likely quite larger than life, unless you're
using an iPhone retina display, in which case it, too, is smaller. For what
it's worth, at left is a version appropriate for my own laptop.

Specific Size

Most printers can't print right up to the border of the paper, unless
they're put into a somewhat vague “borderless printing” mode that under the
hood expands the image slightly to (hopefully) make sure the image goes well past
the edge of the paper, so as to not leave any bare paper exposed. You've
got no choice but to use this if you truly need to print to the edge of the
paper, but if you don't need to (because, for example, the frame you intend
to place the print in covers a smidgen of the edge of the paper), you can
avoid the uncertain fate of “borderless printing” by finding the
“unprintable margin” specs for your printer and including them in the
script configuration. If you get it right, the exact pixels you need
— no more and no less — will be generated for the print job,
avoiding all “resize to fit” shenanigans that would throw off all the
“actual-size” measurements that went into the mat composition in the first
place.

Specific Ink Coverage

If you're not printing to the edge of the paper because part of the
paper will be hidden by the frame, you may as well not waste the ink to
print anything that won't be seen, so you can configure that as well, to leave
the “hidden” parts of the mat unprinted. This is perhaps a bit overkill, but
for dark mats in thick frames, it could save quite a bit of ink.

Here's an exaggerated example to illustrate these points, with particular details
about the left margin...

The result, if done correctly, is a slightly odd-looking mat image because printers “unprintable margins”
tend to not be symmetrical. (Those of my Canon MP810, for example, are 3.388073mm on the sides, 4.98019mm on top,
and 2.98741mm on bottom.) But once printed, the oddities match up perfectly, leaving an exactly-positioned result.

Mat Overlays

I've made it easy to configure overlays onto the mat, such as
signatures, seals, and watermarks. Signing a print on the mat is a perfect
example. My signature looks like a child's, so I'll use John Hancock's
(this PSD,
derived from the version as
seen on
Wikipedia):

Here's what it can look like when automatically overlayed by the script:

The script offers lots of customization on how the overlay is handled...
the example above attempts to mimic an old ink signature that's rubbed off
just a bit over time from the high points on the mat. But just two clicks
and you can get an embossed feel:

These controls respond to the specific mat stipple pattern, so again, everything is quite flexible.

You can also overlay simple text...

Text Overlay( “Japanese Countryside” )

...and again, you have a lot of control in the script what kind of processing you want to apply to the overlay,
and, of course, once the Photoshop document has been built, you can then take over full manual control.

You can arrange for the overlay to be cut along with the mat, as if it
had been part of a physical mat in the first place.

Current Limitations

Some issues that remain to be improved...

250 DPI — So far I've prepared photo-realistic mat textures only at 250 DPI so far.
It's probably fine to use at 200 DPI or 300 DPI, but getting further from the original 250 DPI
will lead to a less natural look.

Needs a UI — It needs a dialog for mat configuration instead of requiring the user to edit a script.
I just don't have the energy to build it now, though.

More Customization — Many more ways things can be customized in the script instead of being left to
manual manipulation in Photoshop itself. Overlay text items, for example, don't yet allow for customization of the font
and such.

Error Handling — Not much work has been done in
detecting and reporting configuration errors... in the face of one, the
script will likely exit with some kind of meaningless message from the
bowels of Photoshop.

Non-ASCII Overlay Text — I haven't figured out how to get non-ASCII text into overlays. (The example above
with Japanese text was created by configuring “TEST” in the script, then editing the text later in Photoshop.)

Mat's Photoshop Document

I'll get into how to configure and run the script later in this post,
but in this section I'll give an overview of the Photoshop document that
the script produces.

What you get depends, of course, on how many mats and overlays and cuts
and such, but the layerset illustrated below should give a good idea of
what you can do between document generation and actual printing.

Going from the bottom....

Layer 1 is just a bright garish color so that
it's easy to notice when you inadvertently leave some area of the document
unfilled, such as when not fitting an image fully behind the mask
properly.

Layer 2 is where your photos goes. If you have
multiple photos, their layers get added to this spot.

Layers 3 - 17 are for the mat; in a document with more than one mat,
each mat is represented by a similar group of layers.

Layer 3 is a non-visible layer used internally by the script.
It's not really needed once the script ends... a future version of the script will likely
delete the layer before finishing.

Layers 4 - 12 are for the thin strips of mat material made visible by the cuts used to create the opening.

Layer 4 is the texture for the inside material.

Layers 5 - 6 allow you to adjust the overall color and brightness of the cuts.

Layer 7 is a very subtle shading added to the edge in the corner where two cuts meet.

Layer 8 - 11 is the base shading applied to the cuts in response to the relative light position.

Layer 12 is an additional shadow of the mat that can, in some cases, fall onto the photo (or underlying mat) and cut edges.
Often you can't even tell it's there, depending on the photo and how you've configured the lighting. You can see
an example above in the "example with two mats of different thicknesses and material" crop, both in how
the shadow of the upper mat falls onto the lower mat, and in the lower mat, a very subtle shadow at the extreme right of the lower cut.

Layer 13 is the clipping layer that defines the front face of the mat.

Layer 14 is the color of the mat. It's just a solid-color adjustment layer, so you can pluck a color
from the photo with the eye-dropper tool.

Layer 15 is the mat texture layer. You can reduce its opacity to reduce the impact of the texture, if you feel the natural texture is too strong for your tastes.

Layer 16 is an additional mat brightness adjustment layer needed if you want particularly bright mats.
The Layer-14 color adjustment layer came from my post asking how to solve this colorization problem,
and Layer 14 alone works fine in many situations, but you can't get really bright or white mats with it, so in those cases you'll also have to visit this layer.

Layer 17 is where any overlay layers are added, in this case illustrated with the John Hancock signature overlay.
Futzing with the layer effects for these layers can yield quite a difference in the look. Particularly fruitful are the Emboss effect,
and enabling/disabling the layer mask, which as been built to exclude where the underlying mat texture has highlights.

Installing The Mat Builder

The mat builder is provided in two zips file, a small one with the main script files, and a large one with the texture patterns.

Clicking on Jeffrey's Mat Patterns.pat (from the second zip) in Finder/Explorer should launch Photoshop and install the pattern presets.
You'll not see anything happen once Photoshop is open, but if you look in
"Edit > Presets Manager > Patterns"
you should find four “Jeffrey's Mat Pattern” patterns.

The other files (*.jsx and *.jsxinc from both zips) must be copied to the
Scripts folder in your Photoshop install. Your install may differ,
but the common locations are:

Mac

/Applications/Adobe Photoshop CS5/Presets/Scripts/

Windows

C:\Program Files\Adobe\Adobe Photoshop CS5\Presets/Scripts\

Once the files are copied and Photoshop is restarted,
“File > Scripts”
should then contain a new item,
“Jeffrey's Mat Builder”.

But, don't run it yet... you'll want to make changes for your specific needs first, which is what
the next section is about.

Updates are done in the same way, though you need install only the new
files when updating from only one of the zips. (I don't expect the pattern
data to be updated all that often.)

Configuring The Script

This kind of application begs for a nice UI that allows you to easily
configure settings and save/invoke presets, but for now you've got to edit
the raw file.

Before showing a full-on configuration file with all options
illustrated, let me show a minimal one that creates a simple A4-sized image
of one mat with a 1.75-inch margin around a central opening:

The configuration itself is on lines 6 through 17, which is then used on
line 19 when invoking the builder. The paper size and DPI must be specified
in every configuration, as must the mats. In this case, there's one mat
using my pattern #2, and it has one cut.

It's set up such that if it's invoked while there's already a document
active in Photoshop and that document has only one layer, a copy will be
inserted behind the mat in the newly-created document. This allows you to
“invoke the script on a photo”, so to speak. But you can always drop photos
in after building the document, as well.

Here's the version included in the script-files
download. It's its own documentation for how to use it... it's got lots of
comments, doesn't rely on default values, and includes all settings,
including ones that aren't used, just to illustrate that they exist.

Running is as simple as invoking “Jeffrey's Mat Builder”.
in the “File > Scripts”
menu. (It may be worth while to assign a keyboard shortcut to it via
“Edit > Keyboard Shortcuts” to make turnaround quicker while tweaking the script.)

That's it. It's not for the faint of heart. Good luck. Did anyone read this far?

One question I already meant to ask when you showed your work in progress but then somehow forgot to:
It seems in all your samples the cut edges cast a shadow straight to the left while the surface texture has its “light source” straight up (and the “embossed” stamp might actually be lit from 9:30 o’clock)? Is that intentional (or am I cross-eyed)?
Otherwise the results are incredibly convincing (I actually noticed those small cues you mentioned), great work!

The mat textures are so vague that I didn’t think the lighting direction mattered… the look changes considerably with the nature of the lighting, but any one view is as random as another, I thought. I suppose it’s possible to encode into the patterns what angle the light comes from, and have the script take that into account when choosing the pattern, but that seems overkill even to me. Thoughts? —Jeffrey

Hmm … Indeed very few viewers will notice – but there are those nitpickers like me. It really depends on your desired level of perfection. 😉
If you wanted to take the direction of your lighting into account for the mat surface I guess you’d need a library of each texture with at least three lighting directions (horizontal, vertical and diagonal). At least some of the textures have a “direction” themselves, so you couldn’t just rotate the texture to “follow the light”. And without a 3D representation of the texture I don’t think you could create the variations from one master, either.
Having the texture lit straight from above obviously is a reasonably universal choice, and I’ll happily use the script as is. (I certainly couldn’t improve anything from that level and I’m definitely not complaining!) Only with your samples (Matched to light coming from a window to the right?) it struck me as somewhat odd to have the virtual light directions at right angles considering the attention you gave to the detail at the cut borders…

I just didn’t think anyone could tell. I’d like to reshoot the mats anyway (it’s much more difficult than one might at first think, because you have to be able to convert them to a pattern that repeats without any obvious seams), so if I do I’ll try to shoot a few angles. —Jeffrey

There is actually a trick to easily creating repeating textures. Take any image of a texture that would have seams when tiled. Then, create a copy of it, and flip it horizontally (mirror image). Abut it on the right side of the original image. In essence, you want to “fold open” the pair of images like a book. Then, make a copy of the new, double-wide image and flip it vertically. Attach it on the bottom of your original. The resulting image will be twice as wide and twice as long as your original, and can be tiled seamlessly.

I don’t think that’s a general solution… you’ll have a seam the moment you put the two mirror images together. It may not be particularly noticeable with some patterns, and for those the technique can be useful, but it’ll stick out like a sore thumb with others. —Jeffrey

Thanks for this excellent package! Your mat textures are fantastic. The attention to detail on the mat simulation (rough edges, little shadows) is unbelievable – or should I say quite believable. We appreciate the work that went into this. I hope you’ll continue your efforts with additional textures and a user interface (for people with script-phobia).

— comment by
Tom Field
on
July 21st, 2011
at
4:40amJST(7 years, 6 months ago)
—
comment permalink

Jeffrey,

This is just awesome. I really want to know when someone creates a UI for it. As it is, just an awesome script for adding the mats. I wish I could change the default to a white mat (plus the brightness adjust to make it a true white). Gray is pretty nice though.

Ah, I know why double windows were not working. There is an error in Jeffrey’s Mat Builder Library, line 1446. left should be replaced with right. 🙂 Now it works great!

Another Question, could you elaborate a little more on how these two variables are used….
light_distance : UnitValue(1, “m”),
light_in_front : UnitValue(5, “m”),

Thanks,

Konrad

Thanks for the find… I’ve pushed out a new version with that fix. The light source for the shadows is light_distance along the wall on the light_oclock angle, then light_in_front directly out away from the wall. —Jeffrey

— comment by
Konrad
on
January 2nd, 2012
at
1:29pmJST(7 years ago)
—
comment permalink

Hi Jeffrey, I thought I’d share how I recently used your excellent script. I used it a little differently than others I would guess.

I found the three original Star Wars movie posters, put your excellent faux black matte around each poster, printed them out and then cut a custom real Matte for the frame I had. It looks great! Cheaper way of doing a double matte.

I have installed these scripts on cs5 with no problem but now I am try to install these in cs6. Install went fine but when I run the script I get an error that says “The command Create Clipping Mask is not available”

Can anybody help with this?

BTW I absolutely love this script and have used it on a lot of things on my wall. Thank you so much Jeff.

Looks like a great script! But I tried loading it into Photoshop CC and it does seem to work, but it does also generate errors. There was an error :”expecting numeric value” which may be my fault, and “Expecting place command, this version of Photoshop may not be compatible.” I hope you update this, as the mats look fantastic!

I’m still on CS5, alas, so I can’t check at the moment. I’ll probably end up getting the CC photographer’s bundle sooner than later, so if I do, I can test it then —Jeffrey

This is great Jeffrey! I have what is probably a really stupid question though, please bear with me. How do I edit the script so that I can add a second mat or change things such as the patterns? What program do I need to do that? I use a mac and CS6. The script works great for a single mat, and is saving me a ton of time. Your script makes a mat that is so much better than just adding a bevel and some shadows like all the other tutorials do. Thanks again

OK, I found a text editor and have tried modifying the script so I can include a double mat. I followed John OB posts, and I don’t get any errors when I run the script, but there is still only one mat. Any ideas? Thanks so much.

It’s impossible to tell what the problem might be from here, and I don’t have the bandwidth to offer individual programming support. If you have a programming-savvy friend, perhaps ask him or her to help you out… —Jeffrey

Thanks for this great tool. I’m using CS4 and had a speed bumps because there is no “Soft Round” brush preset. I did ultimately discover a preset called “Soft Round 5 pixels” and updated it in the Jeffrey’s Mat Builder Library, which worked. However, Photoshop also would mysteriously bomb sometimes on the brush call, but as far as I could tell that was close to the end of the script and most everything seemed to be finished. Lots of work went into this and I appreciate you making it available for free.

I’m a bit johnny-come-lately to this discussion as this was posted over four years ago, but will ask anyway: I note several comments indicate script problems in CC/CS6. Has it been updated in its current incarnation to correct those issues?

No, it’s not changed, but I still imagine it should work in CS6. I don’t have CS6 to test, though. —Jeffrey

I am a long time user of several of your Lightroom plugins (Thank you!) and just came across this script as I was searching for something to do exactly this. Thought I’d drop a comment and let you and others know that I have successfully used this script in Photoshop CC 2015.3 (the latest version) just as it is and it worked perfectly. I did have to comment out the John Hancock signature 🙂

I have used the script with a file open and it worked fine, although it does delete pixels when it crops the image.

I have also used it successfully with no image open to create just the mat and then done a File/Place Embedded to put the file image in which gives a bit more control, at least for me. I have not tried multiple opening mats yet, but will post back when I do.

For double mats, I generated 2 separate mats at different widths and pulling the layers together into the same Photoshop document. Worked like a champ. I then flattened the layers (leaving transparency), placed the mat into a Master page in an InDesign file and placed photos on separate pages resulting in one PDF containing all my photos matted and ready for the printer. Jeffrey – thanks so much for your generosity making this available.

This is positively brilliant! Thanks a million for creating and sharing this wonderful add-in! I can’t believe how realistic the mats look when printed. The photo shop where we had it printed also commented on how nice the mats looked.

I easily created a two-layer mat. The only thing I found tricky was that the patterns seem to contain a lot of grey. So when I tried to create a white mat, for example, it came out as a medium grey. Maybe a pattern with more pure white and light pixels that still showed the texture would be possible.

From Rochester, NY

— comment by
A R
on
April 15th, 2018
at
2:33amJST(9 months, 7 days ago)
—
comment permalink

Leave a comment...

Name

Mail (optional; will not be published)

Notify me of followup comments, or when Jeffrey replies, via email.
Fill in your email and check this box if you expect a reply from Jeffrey and don't want to keep checking the comments manually.