A bulk image importer powertoy for OneNote 2010


 

“Vince”
wrote to me a while back and asked if there was any way to update the text
importer
to import JPG files.  It
seems he had hundreds of these files for an anatomy class and was getting
frustrated with copy/pasting them one at a time into OneNote.  It turns out it was fairly simple to make the
needed changes, so here is the updated tool I wrote.  It works much like the text importer – browse
to the folder that holds the files, select the images you want to import
(CTRL+A will select everything in the folder) and then Import.  Unlike the text importer, you actually have
to select the files you wish to import – it won’t automatically detect the
images in the folder.  It may be easiest to move all the files you want to import into one folder before running this utility.  If someone wants
to update it to iterate through all supported images, feel encouraged!

 

This uses the same
tree control I’ve been using for awhile to let you choose where to import
them.  It uses the file name of the image
for the page name and imports one image per page it creates.

 

I also added some
code to import the image at the same size in pixels as it exists on the hard
drive.  If the image is 1300 pixels wide
and 900 pixels tall, I use that as the height and width of the imported image.  And if it matters to you, I import them as
page level objects rather than putting them in outlines.  This all serves to keep the images from being
“too small” when imported.

 

Although Vince only
needed to import JPG files, the same code works for other image files, so this
toy will import BMP, JPG, GIF or PNG files.

Update:  as of Feb 9, this will now allow for the import of TIFF files.

 

There is no setup for this toy.  Just download the file from below my signature, unzip it and run the EXE.  I’ll post the code next week since Thursday is a day off for us here in the states.

 

Enjoy!

 

Questions,  comments, concerns and criticisms always
welcome,

John

Image Importer.zip

Comments (21)

  1. Brad Stevens says:

    Great work John, this sort of stuff helps show how flexible OneNote really is.  Looking forward to the source code for this one!

  2. phandcock says:

    This is a very useful piece of work.  I scan a lot of course notes into OneNote and this makes it significantly easier.

  3. Kent Krugh says:

    I want to import tiff photos into OneNote, but before importing, I want them resized smaller and then saved as compressed jpgs.  Can this be made possible?

    kkrugh@gmail.com

  4. @Kent

        It is easy to use any photo editing software to do this 😉 can also change names fix colors in a bulk processing way.

    I would love the ability to control how many photos per page (all on one page, 5 per page, etc…) for this powertool.

    Thanks,

    ~Aaron

  5. JohnGuin says:

    kkrugh,

    I added tiff support.  Converting to JPG is beyond the scope of this addin.  Since I put them in as page level, I specifically wanted to avoid resizing them – might be interesting to think about, though.

  6. BR says:

    The file seems to be corrupted–it wouldn't open in my decompression program (7-zip).

  7. Chris McPhail says:

    Source code?

  8. JohnGuin says:

    Sadly, I believe I have lost the code for this.  I had it on a USB stick and can't find it any longer…

  9. 313424|^ says:

    Bummer; I"d really like to see the code.

    I'm using the ON API in PowerShell and got the XML working to import text, but am having trouble with images as they seem to be stored separately in Base64.

    Can I just put the Base64 in data tags or is there some other way to pass the image?

  10. John says:

    Just use the spy tool (or write your own) to get the XML of a page that has an image.  Then you can see the xml needed for the base64 data.  Something like this:

           <one:Image format="png" >          <one:Data>iVBORw0KGgoAAAANSUhEUgAAAAgAAAAHCAIAAAC6O5sJAAAAAXNSR0IArs4c6QAAABZJREFUGFdj

    /P//PwM2wIRVFCg4oBIACo8DC8wqehIAAAAASUVORK5CYII=</one:Data>

           </one:Image>

    This is a small (7×7 pixel) image.  One other tip – be sure to get binary data if you query the page xml so you can see this.  

  11. Good afternoon John, very good tool!

    would you post the source code?

  12. Chris says:

    Is there a bulk importer to import contents from RTF files. I got thousands of files that I need to import to OneNote into single tabs or pages.

  13. John says:

    No there is not (to my knowledge).  RTF is a very rich format and would need to run through an RTF to HTML converter to get this to work.

    I can think of 2 options.

    1. Print to OneNote.  Not as silly as it seems since OCR will work for searching the documents.

    2.You could use autohotkey (www.autohotkey.com) to write a macro to open each file, then select all/copy/paste to OneNote.

  14. Scott Bell says:

    I need to do the opposite.  I inserted dozens of screen shots and I'd like to save them all to out disk so I can make thumbnail pages and sort them.  I could use the time as the name… maybe prefixed with the section name.  A batch export would be great 😉

    BTW Your blog is the only place I've found for One Note source code–thank you!

    But why isn't there any VSTO videos on One Note on Channel 9?  

  15. JohnGuin says:

    The images, if they are more than 10K or so, are saved in your cache folder but in a very annoying way.  They all have a GUID name and no three letter extension, so you might be able to write some code to see which of these files are images and make thumbnails that way.  Sorting by time may help find them here…

  16. Scott Bell says:

    Wow, sorry I didn't check back here sooner; thanks John! That was a fast reply and it worked just fine.

    BTW is there an offical wish list for features for future versions of OneNote?

  17. John says:

    We're always interested in suggestions – feel free to email me with the link in the upper right.

  18. Steven Buehler says:

    Unfortunately, doesn't work in Outlook 2013. Just creates an "Untitled Page". :-(

  19. John says:

    Right – I never updated this to 2013…

  20. Mike says:

    Would be nice if you did, this looks like one awesome addon I'd love to use. :)

  21. nestor says:

    Dis you find the source code? Did you update to 2013?