Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
I tried this too: (ns tma-make-thumbnails.make-images (:import (java.util UUID) (javax.imageio ImageIO) (java.awt.image BufferedImage) (javax.imageio ImageReader)) (defn get-file-as-image [filename] {:pre [(= (type filename) java.lang.String) (fs/exists? filename)

Re: Why do I have to register an ImageReader?

2014-02-27 Thread Aaron Cohen
On Thu, Feb 27, 2014 at 3:44 PM, larry google groups lawrencecloj...@gmail.com wrote: I tried this too: (ns tma-make-thumbnails.make-images (:import (java.util UUID) (javax.imageio ImageIO) (java.awt.image BufferedImage) (javax.imageio ImageReader)) (defn

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
Ah, I see what happened. There was a Microsoft Word document in my folder of images. It was causing the problems. I had no error handling for non-images. On Thursday, February 27, 2014 3:52:09 PM UTC-5, Aaron Cohen wrote: On Thu, Feb 27, 2014 at 3:44 PM, larry google groups

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
Hmm, I made it a little further. Now I am trying to write a thumbnail to disk. I have copied the code from StackOverflow. I am using this function: (defn make-thumbnail [filename path-to-new-file-including-file-name width] {:pre [(= (type filename) java.lang.String) (fs/exists?

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
I wanted to see what Format strings I am allowed, so at the repl: user (import 'javax.imageio.ImageIO) javax.imageio.ImageIO user (require '[clojure.pprint :as pp]) user (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))[BMP, bmp, jpg, JPG, wbmp, jpeg, png, JPEG, PNG, WBMP, GIF, gif]

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
and if I look here: http://www.mkyong.com/java/how-to-write-an-image-to-file-imageio/ I see this example: ImageIO.write(image, jpg,new File(C:\\out.jpg)); ImageIO.write(image, gif,new File(C:\\out.gif)); ImageIO.write(image, png,new File(C:\\out.png));

Re: Why do I have to register an ImageReader?

2014-02-27 Thread Aaron Cohen
This is going to result in a pretty ugly thumbnail because you're missing the hints java needs to do high quality resizing. Java's shrinking also doesn't really have a nice smoothing mode. I'd actually recommend you look into https://github.com/mikera/imagez. It has a resize function in core

Re: Why do I have to register an ImageReader?

2014-02-27 Thread Aaron Cohen
You definitely don't want a period in your format string. Why are you calling(.drawImage g img 0 0 width height nil). What's the nil for? I'd try dropping it. On Thu, Feb 27, 2014 at 5:17 PM, larry google groups lawrencecloj...@gmail.com wrote: and if I look here:

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
Thanks for the tip about imagez. I wanted to get something basic working today, but I'll give imagez a look tomorrow. As for now, I feel like I should not give up till I have figured out what the problem is. On Thursday, February 27, 2014 5:17:20 PM UTC-5, Aaron Cohen wrote: This is going

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
I found this: http://stackoverflow.com/questions/3432388/imageio-not-able-to-write-a-jpeg-file So I changed this: imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB) to this: imgtype (java.awt.image.BufferedImage/TYPE_3BYTE_BGR) and that worked for one image. The next image

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
Okay, everything works now. Apparently that last problem had something to do with differences between OpenJDK and the SunJDK. I have: java -version openjdk version 1.7.0-ea OpenJDK Runtime Environment (build 1.7.0-ea-b222) OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode) I don't recall