Comments (8)
a better one: https://jsfiddle.net/jdcvpvty/2/
from vue-croppa.
@Tarasovych Yes, you can use canvas-color="white"
to make transparent background of png images white
from vue-croppa.
Yes, that was exactly it. I changes the :canvas-color to 'transparent' and now existing PNGs retain their transparency.
The downside of this is that you can no longer see the size of the canvas.
My suggestion is to add the following properties:
:border="true"
:border-color="default"
:border-size="2"
Up to you. I can live with it the way it is now, so just a suggestion.
All around, good work! Most other components that do the same were just way too bulky.
from vue-croppa.
Thank you for your support :))))) It's my first open source project that's actually useful for others lol.
Yes, it was intended that :canvas-color should fill the "white space" of the image. If you'd like it to be transparent and also be able to see the canvas zone, you can add some css styles on .croppa-container
. Like this: https://jsfiddle.net/jdcvpvty/1/
Note that the css styles won't have effects on the output image, while :canvas-color will.
from vue-croppa.
Excellent! Thanks!
from vue-croppa.
@zhanziyang I faced this problem today, may I ask if setting canvas-color="white"
is good solution for keeping png images transparent background white, but not black (according to the question, default canvas background is black)?
I mean, when I left canvas-color="transparent"
and 'image/jpeg'
at generateBlob()
, I got black background as a result, where there is actually no background because of png format.
When I went canvas-color="white"
and kept 'image/jpeg'
at generateBlob()
, I got white background where it might be transparent.
My backend stores all images in jpeg anyway, so I need white where it's transparent, if png is uploaded. Thank you.
from vue-croppa.
1 1/2 years later I'd just like to say thanks for this!
from vue-croppa.
from vue-croppa.
Related Issues (20)
- Error "The operation couldn't be completed. (WebkitBlobResource error 1.)" on iOs.
- Black corners when use plugin
- Slow for large images on Android HOT 1
- File type mismatch event not passed when selecting the same wrong file twice (Chrome)
- Resource interpreted as Stylesheet but transferred with MIME type text/plain
- [Migration] Are there any plan to support Vue3? HOT 5
- How to insert a pin image after a mouse click?
- Could not find a declaration file for module
- Image Height and Canvas Size Problem
- Crop like Instagram
- Crop like Instagramm
- 可以支持vue3.0? HOT 1
- zoomIn() and zoomOut() make image smaller
- Different result image quality on different screens (blurry images) HOT 1
- add setter for outputWidth and outputHeight or ability to control this.myCroppa.width and this.myCroppa.height directly before calling this.generateDataUrl to control output size
- Image freezes after moving it a dozen times
- Image isn't being cropped in my case HOT 1
- Scale is null after uploading image with same dimensions as previous image
- Is there a way to fire an event if user zooms in or out? HOT 1
- Uploading PNG Logo Image
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 vue-croppa.