DD

April 18, 2010

Plustek OpticSlim M12 Plus + Mac OS X AppleScript + Folder Actions + Noise Ninja + Evernote

Filed under: Uncategorized — Tags: , , , , , — ddeliya @ 7:40 am

Plustek OpticSlim M12 Plus is a nice really small scanner. After few weeks of usage it started showing lot’s of noise in scanned images (I use 300 DPI). As I was already using Mac OS X Folder actions script from Andrew (one of the comments on Evernote Blog page about scanning on Mac), I decided to add denoising using NoiseNinja there. This is the resulting script I wrote (you can find properly indented code here: http://pastebin.com/P4yi5Xg5):

Code start ======================================

(*
add – new item into Evernote

Process the file in NoiseNinja beforehand
NoiseNinja should have a setting “Start in a SideKick mode”

*)

on adding folder items to this_folder after receiving added_items
set Make_ to “Plustek”
set Model to “OpticSlim M12 Plus”
set ISO to “200″
set NoiseNinja_filepath to POSIX path of “Applications:NoiseNinja.app”

tell application “System Events” to set NoiseNinja_count to count (every process whose name is “NoiseNinja”)

if NoiseNinja_count is equal to 0 then
tell application “NoiseNinja” to activate
tell application “System Events”
set visible of process “NoiseNinja” to false
end tell
delay 1
end if

delay 2

repeat with item_ in added_items
set image_filepath to POSIX path of item_

– Set EXIF parameters for NoiseNinja to catch profiled image properly
set exiftool_successful to false
try
set command to “exiftool -overwrite_original -Make=’” & (Make_) & “‘ -Model=’” & Model & “‘ -ISO=” & ISO & ” ” & quoted form of image_filepath
do shell script command
set exiftool_successful to true
end try

– display dialog “Hello!”
set NoiseNinja_successful to false
set initial_size to size of (info for item_)
– display dialog “The file is ” & (initial_size as integer) & ” bytes”
try
set command to “open -a ” & quoted form of NoiseNinja_filepath & ” ” & quoted form of image_filepath
do shell script command
set NoiseNinja_successful to true
end try

– Now wait till NoiseNinja saves the file
if (exiftool_successful = true) and (NoiseNinja_successful = true) then
set new_size to size of (info for item_)
repeat until new_size is not equal to initial_size
delay 0.5
set new_size to size of (info for item_)
end repeat
delay 1
end if

tell application “Evernote”
create note from file item_ notebook “Scanned”

end tell
end repeat

end adding folder items to

Code end ======================================

For the denoising to be most useful, I printed out the Noise Calibration Chart of NoiseNinja, and scanned it using the same settings of the scanner I usually do. Afterwards I’ve created noise profile for the scanner as described in NoiseNinja User Guide.

NoiseNinja SideKick mode can automatically select proper noise parameters sheet, if EXIF fields of an image correctly specify Maker, Model and ISO of an image. As the DigiScan software, included with plustek scanner, does not fill those fields, I downloaded the EXIFTool by Phil Harvey here.

So the workflow is as follows. DigiScan software places jpg image from scanner in a folder. A folder action script fires on this image. Script checks if NoiseNinja is launched, and if not, launches it. There is a 1 second delay to let NoiseNinja start. NoiseNinja starts in a SideKisk mode.

After this, EXIFTool writes scanner name, manufacturer and an ISO field into EXIF fields of the jpg image. NoiseNinja is started to process it. NoiseNinja gets EXIF fields and loads appropriate noise profile, denoises image and saves it, overwriting original. While this is happening, script is monitoring the size of jpg (as it should change when NoiseNinja starts saving the results). After change in size is detected, there is a delay to let file saving to finish. After this delay, Evernote is asked to create a note from a denoised image.

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.