View Single Post
Old 09-07-2018, 09:14 PM   #5
retrography
Member
retrography is on a distinguished road
 
Posts: 23
Karma: 50
Join Date: Jul 2018
Location: Amsterdam
Device: Onyx Boox Max 2 / PocketBook Inkpad 3 / Kindle Paperwhite 3
Exporting PNGs from Notes to Evernote (on Max 2) to enable OCR image search

In absence of that facility, here is an AppleScript (if you are on Mac) that exports the PDFs from the selected notes, retains only the scribble layer (discards the template), converts that layer into PNGs and then appends those PNGs at the end of the original notes:



Code:
tell application "Evernote"

set thePath to path to temporary items

set thePath to the POSIX path of thePath

set thePath to thePath & "ever"



set theSelection to get selection

repeat with theNote in theSelection

set theSelecList to {theNote}

export theSelecList to thePath format HTML

do shell script "cd " & thePath & "; /usr/local/bin/pdfimages -p -png *.resources/*.pdf ever; /usr/local/bin/mogrify -negate *.png"

set theImages to do shell script "cd " & thePath & "; for i in $(/bin/ls *.png | /usr/bin/cut -d '-' -f 2 | /usr/bin/uniq); do /bin/ls ever-$i-*.png | /usr/bin/tail -n 1; done | /usr/bin/tr '

' ',' | /usr/bin/sed 's/.$//'"

set AppleScript's text item delimiters to ","

set the imageList to every text item of the theImages

set AppleScript's text item delimiters to ""

repeat with theImage in imageList

append theNote attachment thePath & "/" & theImage

end repeat

end repeat

do shell script "rm -rf " & thePath

end tell
Btw, you need Poppler and ImageMagick for the script to run.

Last edited by retrography; 09-07-2018 at 09:43 PM.
retrography is offline   Reply With Quote