- C++ 82.2%
- Python 14.9%
- C 2.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Illustrator copies the master document's thumbnail into every file produced by "Save each artboard to a separate file", so Explorer ends up showing the same wrong preview on all of them. This hooks the save-complete notifier, scans the output folder for the files that save just wrote, and quietly reopens and resaves each one so Illustrator regenerates a correct preview. Runs on every save with nothing to click. |
||
| docs | ||
| src | ||
| tools | ||
| .gitignore | ||
| README.md | ||
| ThumbnailAutoFix.vcxproj | ||
Illustrator Thumbnail Auto-Fix
A Windows Illustrator plug-in that fixes the wrong thumbnails you get from "Save each artboard to a separate file".
When Illustrator splits a document into one file per artboard, it copies the master's thumbnail into every file it writes. Each file holds one artboard but shows the full multi-artboard image, so Explorer gives you a folder of identical, wrong previews.
Reopening one of those files and saving it again makes Illustrator write a correct thumbnail. This plug-in does that for you as soon as the split save finishes. You never have to click anything.
Build
You need:
| Illustrator | 2024 (28.x), 64-bit |
| Adobe Illustrator SDK | 2024, verified against Build 142 |
| Visual Studio 2022 | or just VS Build Tools 2022, with the MSVC v143 x64 toolset |
| Python 3 | on your PATH |
Any Windows SDK version works. Nothing is pinned, and 10.0.19041.0 is fine.
Get the Illustrator SDK from https://developer.adobe.com/. Sign in with an Adobe ID, then look under Download Resources on the developer console for the Windows SDK matching your Illustrator version.
Then:
- Clone this repo.
- Extract the SDK into it so that this folder exists:
sdk/2024/Adobe Illustrator 2024 SDK/illustratorapi/ - Run the build:
msbuild ThumbnailAutoFix.vcxproj /p:Configuration=Release /p:Platform=x64
That produces build\x64\Release\ThumbnailAutoFix.aip.
If msbuild is not on your PATH, call it by full path:
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" ThumbnailAutoFix.vcxproj /p:Configuration=Release /p:Platform=x64
To keep the SDK elsewhere, point the build at it:
msbuild ThumbnailAutoFix.vcxproj /p:Configuration=Release /p:Platform=x64 /p:AISDKRoot="D:\path\to\Adobe Illustrator 2024 SDK"
One oddity: the SDK's own sample projects ask for PlatformToolset v142, which is Visual Studio 2019, though the SDK's ReadMe requires Visual Studio 2022. This project targets v143, matching the ReadMe.
Install
Close Illustrator first.
Copy ThumbnailAutoFix.aip into:
C:\Program Files\Adobe\Adobe Illustrator 2024\Plug-ins\
That folder is protected, so you need an elevated shell or the UAC prompt from Explorer.
Now start Illustrator. Illustrator scans for plug-ins only at startup, so you must restart it.
To check it loaded, open Window, Utilities, "Thumbnail Auto-Fix: Show Status". It reports the build version, whether the hooks registered, how many files it has repaired or skipped or failed on, and where the log lives.
Using it
Nothing to configure and nothing to switch on. Once installed, the plug-in runs on every save for as long as Illustrator is open.
Save a document with "Save each artboard to a separate file" ticked. About three seconds later Illustrator flashes as the plug-in opens each split file, saves it, and closes it. Budget roughly a second per file. When the flashing stops, the thumbnails are correct.
That flashing is unavoidable. Only Illustrator itself can regenerate an Illustrator thumbnail, and only by opening and saving the file. The plug-in does put you back in whatever document you were working in when it finishes.
Uninstall
Close Illustrator, delete ThumbnailAutoFix.aip from the Plug-ins folder,
start Illustrator again. The plug-in writes no registry keys and no preferences
files.
Its log directory is the only other thing it ever touches. Delete
%LOCALAPPDATA%\IllustratorThumbnailAutoFix\ to remove that too.
Log
%LOCALAPPDATA%\IllustratorThumbnailAutoFix\plugin.log
type "%LOCALAPPDATA%\IllustratorThumbnailAutoFix\plugin.log"
Every file the plug-in queues, repairs, skips or fails on gets a line, and skips say why. Nothing ever pops up a success dialog. The log and the status menu item are the only places the plug-in talks to you.
How it works
At startup it registers for kAIDocumentWriteOnDiskCompleteNotifier and
kAIDocumentWriteOnDiskFailedNotifier.
When a save completes, the callback does almost nothing: it tidies the path, discards duplicates, and starts a timer. No document work happens inside the notifier.
Three seconds later the plug-in scans the folder that file went into, looking
for other .ai files written at the same moment, and queues those too. Then
AITimerSuite works through the queue one file every half second, well clear of
the save that started it.
Each file gets opened with kDialogOff, saved, and closed. No dialog can appear
during any of it. The file already has a path, so saving cannot prompt for one,
and it is unmodified immediately after the save, so closing cannot ask about
unsaved changes.
Why it has to scan the folder
This part took two attempts to get right.
kAIDocumentWriteOnDiskCompleteNotifier is documented as "Sent when a document
has been written to the disk", and the data it hands you,
AIDocumentWriteOnDiskCompleteNotifyData, holds exactly one
documentFilepath. A split save is one document being saved that happens to
produce a dozen files, so Illustrator only ever names the master. It never
announces the split files, and no artboard, asset or export notifier anywhere in
the SDK lists them.
Notifications alone therefore cannot find the files that need fixing. Worse, the one path you do get is the master, which is still open in Illustrator and so gets skipped. An earlier version of this plug-in worked that way and repaired nothing at all.
Scanning the folder is the only mechanism available. A file counts as "written
by this save" if it is a .ai in the same folder whose modification time falls
within 30 seconds of the master's. The scan ignores filenames deliberately.
Guessing wrong about how Illustrator names split files would skip them silently,
the one failure you would never notice, while a false positive costs a single
harmless resave.
There is no thumbnail API to call
The obvious first question, so: the SDK's only preview-writing function is
AIDocumentSuite::WriteDocumentMacInformationResource, and AIDocument.h marks
it @deprecated Does nothing in AI13 (CS3). It was macOS only anyway.
kAIEPSIncludeThumbnailKey exists but applies to EPS files, not native .ai.
Resaving is not a workaround for a missing API. It is the supported way to do this.
Open documents are left alone
An ordinary Ctrl+S fires the same notifier, but the document is still open at that moment, and Illustrator has already given it a correct thumbnail. So the plug-in skips anything currently open and logs the reason. Split files are written closed, which is exactly the case that needs help.
WriteDocumentWithOptions can rewrite an open document's preview, but it
operates on the current document, which would mean yanking you into a
different file mid-edit. Too disruptive for something that runs on every save.
It cannot get stuck in a loop
The plug-in's own save triggers another WriteOnDiskComplete for the same file,
the obvious way something like this eats itself.
So before saving anything it timestamps that path, then drops any notification
for a path it stamped within the last 15 seconds. Fifteen seconds covers a slow
write of a large document plus a notification arriving after Save() has
already returned.
About tools/make_pipl.py
Every Illustrator plug-in needs a PIPL resource, a small binary blob naming the
plug-in and its entry point. The SDK ships a generator for this at
tools/pipl/create_pipl.py, and this project does not use it.
That script is Python 2, and it fails two ways under Python 3. It writes str
into a file opened in binary mode, which stops the build outright. You notice
that one. The other is nastier: it branches on platform.system() is 'Windows',
an identity comparison against a string literal, always false on Python 3. So it
quietly takes the macOS path, writes the Mac entry point, omits the Windows one,
and hands you a PIPL that Illustrator silently refuses to load.
tools/make_pipl.py writes the same binary layout correctly, reading Adobe's
own template_plugin.json so the property values stay theirs. I checked its
output byte for byte against the PIPL inside a plug-in Adobe ships,
Plug-ins\Extensions\Action.aip.
Other Illustrator versions
Rebuild against that version's SDK. The sources need no changes, which I verified by building them unmodified against the Illustrator 2026 SDK (Build 114):
msbuild ThumbnailAutoFix.vcxproj /p:Configuration=Release /p:Platform=x64 /p:AISDKRoot="D:\path\to\Adobe Illustrator 2026 SDK"
Everything this plug-in touches is stable between the two SDKs. The notifier
name strings are identical, AIDocumentWriteOnDiskCompleteNotifyData is
unchanged, and Open, Save, Close, Count, GetNthDocument and Activate
all keep the same signatures.
The suite version numbers do move:
| Suite | 2024 | 2026 |
|---|---|---|
AIDocumentSuite |
21 | 21 |
AIDocumentListSuite |
11 | 12 |
AITimerSuite |
5 | 6 |
AINotifierSuite |
4 | 5 |
AIUnicodeStringSuite |
9 | 10 |
AIMenuSuite |
11 | 11 |
AIUserSuite |
21 | 21 |
SPBlocksSuite |
2 | 2 |
src/ThumbFixSuites.cpp asks for the unversioned macros, so
kAIDocumentListSuiteVersion rather than a hardcoded 11. Those resolve to
whatever SDK you compile against, which is why porting costs a recompile and
nothing else. If you write your own plug-ins, copy this habit.
The compiled binary is still tied to one version. This 2024 build asks for
AIDocumentListSuite version 11, and the 2026 SDK no longer defines that
constant. If Illustrator 2026 no longer offers the older version, AcquireSuite
fails and the plug-in will not run. Build one per major version.
Limitations
The three second wait before scanning is a fixed guess. A document with a great
many artboards might still be writing when the scan runs, and late files get
missed. The log says how many siblings it queued, so compare that against your
artboard count. If it comes up short, raise kSweepDelayMs in
src/ThumbFixPlugin.cpp and rebuild.
Because the scan matches on write time, an unrelated .ai dropped into the same
folder within 30 seconds of your save gets resaved too. Harmless, just wasted
work, and the log names every file it touches.
The plug-in opens only .ai files. It logs and ignores everything else.
It backs nothing up. It resaves in place, through Illustrator's normal save path, on a file Illustrator itself wrote moments earlier, using the options already stored in that document.