SvenWoltmann / color-thief-java

Grabs the dominant color or a representative color palette from an image. A very fast Java port of Lokesh Dhakar's JavaScript version.
231 stars 40 forks source link

ArithmeticException when Image is too big #1

Open confile opened 9 years ago

confile commented 9 years ago

I tried your lib with a 7,8MB image. the operation I did was:

int[] result = ColorThief.getColor(bufferedImage, 0, true)

Here is the error I get:

   Line | Method
->>  252 | getPixelsFast    in de.androidpit.colorthief.ColorThief
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    183 | getColorMap      in     ''
|    127 | getPalette . . . in     ''
|     75 | getColor         in     ''
|    121 | save . . . . . . in majestella.admin.AdminImageItemController$$EPQQlXSS
|    198 | doFilter         in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . in grails.plugin.cache.web.filter.AbstractFilter
|     53 | doFilter         in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|     62 | doFilter . . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|     46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
|   1145 | runWorker . . .  in java.util.concurrent.ThreadPoolExecutor
|    615 | run              in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . . . .  in java.lang.Thread
SvenWoltmann commented 7 years ago

Sorry for the late response. I had an outdated e-mail address in my github account and just noticed that a few days ago when I worked on another github project.

I just tested the code with several images ranging from 10 to 66 MB and no exceptions were thrown.

If you send me the image that caused the exception, I can have a look at it.