ericnograles / browser-image-resizer

A tiny browser-based library to downscale and/or resize images using canvas
MIT License
98 stars 42 forks source link

Larger file size than inputted file. #21

Closed josh08h closed 3 years ago

josh08h commented 4 years ago

I'm using these settings:

const imageResizerConfig = {
  quality: 1,
  maxWidth: 3000,
  maxHeight: 3000,
  autoRotate: true,
  debug: true
};

and when I load an image that is below the max dimensions, I am seeing the end result become double the size of the original file.

For example, a png file has the original size of 130930 bytes. When I put it through readAndCompressImage and create a new file (using File API) from the returned blob I am seeing a new file size of 230394 bytes.

Could you explain this please?

ericnograles commented 4 years ago

@josh08h That's unusual; I wouldn't know offhand since this library just piggybacks off of Canvas, so I'll need to do some testing to find out what's going on there,

ericnograles commented 4 years ago

@josh08h quick question -- are you trying to upscale an image? That is, you're trying to make the image be bigger than its original size in terms of height/width?

ericnograles commented 3 years ago

Closing due to inactivity, please feel free to reopen an issue if this persists