Comments (22)
I've just published version 2.1.0
adding the imageTransformOutputQualityMode
option.
Set it to 'optional'
to only apply quality when resizing, cropping or changing file format.
from filepond-plugin-image-transform.
Great, that works.
from filepond-plugin-image-transform.
The problem seems to be here:
// no transforms defined, we done!
if (quality === null && type === null && !crop && !transforms.length) {
where in transforms list there I have one transformation - resize - but since that is upscale=false, did not apply for my image, but is still in the list of transforms and the image is re-encoded
from filepond-plugin-image-transform.
Good one.
A transform can be defined but it can still have no effect on the output. For instance when the image size matches the required output size or there's no upscaling allowed and the image is smaller than the target size.
Will see if I can add this somehow.
from filepond-plugin-image-transform.
One way easy to do I thought would be just compare the imagedata after the transform worker returns the response. If the imagedata are unchanged, you can upload the original image. Problem I found is that the original image does not seem to be stored anywhere.
from filepond-plugin-image-transform.
That could work but I'm a bit worried comparing big ImageData objects might be too heavy on the CPU.
A way to know if a transform should be applied or if it has already been applied ( suppose the file is loaded from the server and has already been compressed / filtered / watermarked / resized / etc. ) would be more flexible and faster. With server files the server could return some additional information with the file ( as a custom header maybe ), then each transform ( currently it's only the crop and resize plugins, but I'm planning to add more ) could expose a boolean indicating whether it should be applied or not.
from filepond-plugin-image-transform.
That would definitely make more sense to do sort of verification on transforms before the image is loaded into canvas, since in case there are no transforms to be applied, that would not be necessary.
from filepond-plugin-image-transform.
@kasparek Just wanted to let you know that this is still on my radar but haven't gotten around to picking it up yet.
from filepond-plugin-image-transform.
from filepond-plugin-image-transform.
It's tricky so I'm taking a bit of time to consider a good (future proof) approach, would hate to build something and have to make breaking changes later on.
from filepond-plugin-image-transform.
Just wanted to let you know that it's still on my todo list, life has got in the way ;-)
from filepond-plugin-image-transform.
from filepond-plugin-image-transform.
I'm wondering if the new File Poster plugin combined with file mock information could help resolve this issue.
Add file mock information and poster image, with these settings FilePond does not load the actual file but creates a mock item. In this setup, the files don't have to be re-uploaded (and are therefore not transformed twice)?
const pond = FilePond.create({
files: [
{
// the server file reference
source: '12345',
// set type to local to indicate an already uploaded file
options: {
type: 'local',
// mock file information
file: {
name: 'my-file.png',
size: 3001025,
type: 'image/png'
},
// url used by poster plugin
metadata: {
poster: './url/to/my-file-thumb.png',
}
}
}
]
});
from filepond-plugin-image-transform.
from filepond-plugin-image-transform.
Alright, I assumed this only concerned files uploaded by the user in an earlier session.
from filepond-plugin-image-transform.
Can you try with this alpha version of the image resize plugin?
https://github.com/pqina/filepond-plugin-image-resize/tree/1.2.0-alpha
It tests the original image size against the target image size and if they're the same, or if upscaling is disabled and the original image is smaller it wont set the resize info.
from filepond-plugin-image-transform.
from filepond-plugin-image-transform.
Okay, I’ll test this further when I get back from vacation in two weeks, had my fingers crossed that this was a quick fix to get it working.
from filepond-plugin-image-transform.
Just got back and ran some tests. I missed some edge cases. I've added reading of image orientation and the resulting width height corrections plus corrections for null
values in the imageResizeTargetWidth
and imageResizeTargetHeight
properties. Just published version 2.0.1
of the image-resize plugin which contains these fixes, please let me know if this solves the problem on your side.
I've also published version 1.1.2
of the image-transform plugin, it's not related to this problem but it does fix another EXIF orientation bug so it's best to update that plugin as well.
from filepond-plugin-image-transform.
Great, will test and let you know.
from filepond-plugin-image-transform.
So, I'm not sure if I'm doing something wrong, but the image when smaller than target size and upscale is false, is correctly not upscaled (is uploaded with same dimensions), but still re-encoded (the filesize is different). This is my configuration for filepond:
FilePond.create(
input,
{
imageTransformOutputQuality: 60,
imagePreviewHeight: 270,
imageResizeUpscale: false,
imageResizeTargetWidth: 2190,
imageResizeTargetHeight: 2190,
imageResizeMode: 'contain'
}
);
from filepond-plugin-image-transform.
It gets re-encoded because the output quality parameter is set.
I'm going to add a bool that allows you to configure it to only apply quality to images when they require a transform.
from filepond-plugin-image-transform.
Related Issues (20)
- TypeError: Cannot read property 'data' of undefined - when outputting Base64 string HOT 2
- Uncaught error for TIFF image files HOT 4
- can't find docs for adding text to the bottom of an image with a metadata object HOT 4
- Filename is lost after transform HOT 6
- imageTransformVariants resize issue: Uncaught (in promise) TypeError: Cannot set property 'size' of undefined HOT 10
- Image Thumbnail Creation with Resize HOT 2
- transforming animated GIFs HOT 3
- Question variants name APPENDED HOT 1
- TypeScript support? HOT 2
- imageTransform is re-compressing (even when no changes) unless imageTransformOutputMimeType is set
- Documentation 404 HOT 2
- [Feature request] Add method on file to retrieve the blob of the transformed image HOT 6
- Duplicate Identifier 'FilePondFile' HOT 2
- Backend can get only last image object HOT 3
- Can we add webp? HOT 6
- No Releases yet. HOT 1
- Error when uploading file with specific bitmap
- Offline SVG markup causes Filepond to stop handling files HOT 1
- Crop and resize to exact ratio HOT 3
- Filesizes increases while image is (visually) not being transformed. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filepond-plugin-image-transform.