2005.09.06 03:30 PM
GIF Plug-in for Cropper 1.6
Even though there are a million ways to capture screen shots in Windows, I still find Brian Scott's Cropper the handiest.
Cropper version 1.6 added a plug-in architecture, so I decided to leverage my recent work with GIF image generation in .NET to write a plug-in of my own:
Cropper.GifFormat.ewbi.v1.0.zip
Just drop the DLL in Cropper's plugin folder.
I built and tested the plug-in using Cropper version 1.6.24; beyond that, I have no idea what version(s) of Cropper it will work with. Also, I added "ewbi" to the plug-in's assembly name and Output menu item to distinguish it from Brian's own GIF plug-in, which he suggested was in the pipeline during the last ChiDotNet meet-up.
The plug-in includes options for marking a palette color transparent either automatically using the first pixel's color or manually by choosing from the image's color palette (I know the dialog is cheesy, so sue me). It also offers the option of using the default .NET GIF color encoding logic or an advanced octree-based color quantizer. The latter was based on Morgan Skinner's wonderful Optimizing Color Quantization for ASP.NET Images, which was itself based on Jeff Prosise's CQuantizer in Wicked Code. This advanced quantization technique produces significantly clearer GIF images.
Here's the form used to collect these options:

Cropper's plug-in architecture doesn't provide for collecting plug-in specific settings except when catching the ImageCaptured event. This is kind of a drag, as it interrupts each subsequent capture with a dialog. Brian and I talked about how Cropper might accommodate this in the future, but for now I offer an option where the settings form can be suppressed (just uncheck the "Show this form for each image" option), and can be accessed independent of any actual captures by pressing Alt-G.
I think I got thumbnails working correctly in my plug-in. It was a little tricky, because the thumbnail image provided by Cropper is derived from the full-size image, and so messing with its palette (for quantization and/or transparency) was messing it up. This was pretty easily solved by creating a new bitmap image from the Cropper-captured thumbnail in the ImageCaptured event before requesting the FetchOutputStream callback. Note, though, that when using the manual transparency option, you'll have to pick the transparent color for both the thumbnail and full-size images.
Here's an octree-based capture and its thumbnail:
![]() |
Here's the same capture using .NET's standard GIF encoder:
![]() |
Brian hasn't released the source yet for Cropper version 1.6, so I'll hang on to mine, too. Of course, you can always peer inside using Reflector, which is what I did in order to write my plug-in without the source to Cropper.
Finally, the standard caveats apply: My plug-in is free to use, distribute, complain about, burn, or flush down the toilet. It includes a copyright, so please don't pawn it off as your own, but feel free to steal and repurpose the code any way you want. I'm offering no warranties and will not be held responsible for any damage it causes you, your computer, your career, or anything else.
Let me know if you have any questions.
Comments
Nice plug-in Eric. Lets talk more about your experience writing it when we get a chance, maybe the next meeting. With the coming effects plug-ins I am thinking about a more robust output format to complement them.
Brian Scott | 2005.09.14 02:30 AM
Is there a working link for your Cropper plugin?
http://www.ewbi.com/ewbi.develop/freebies/Cropper.GifFormat.ewbi.v1.0.zip no worky.
Jeff | 2006.11.27 11:27 AM
I just set up www.codeplex.com/cropperplugins
Would you like to add your GIF plugin?
Jon Galloway | 2007.02.14 10:35 PM
First to Jeff (in case he ever returns): Sorry I didn't get you a response sooner, I didn't even see your comment until just now. The server must have been down momentarily or something, but it's been back for quite a while now.
Next to Jon: Sure, thanks. Do I have to do anything or will you deploy it there? If you do, is there a way to include the caveats described above? Also, I noticed Brian's up to 1.9 now, with Vista support too, but I haven't tried this thing with anything beyond 1.6.24, so folks should be aware of that. It just keeps moving further and further down my list. I should just release the source. Just let me know what you need.
ewbi.develops | 2007.02.14 11:00 PM
Post a Comment
TrackBack
TrackBack URL: http://www.typepad.com/t/trackback/3134920
Listed below are links to weblogs that reference GIF Plug-in for Cropper 1.6:


