rodrigograca31 / Canvas2ImagePlugin

PhoneGap / Cordova plugin for iOS to save the contents of an HTML canvas to the device's Photo Library
19 stars 13 forks source link

Save as JPEG instead of PNG #5

Closed ataylor32 closed 5 years ago

ataylor32 commented 5 years ago

It looks like this issue was never resolved:

https://github.com/devgeeks/Canvas2ImagePlugin/issues/12

I'm working on an app that would benefit from this.

rodrigograca31 commented 5 years ago

:thinking:

rodrigograca31 commented 5 years ago

I have a big app that uses this plugin.... Every now and then some users complain about image quality..... I think JPEG is more compressed thus should have less quality but this might be problem they are having..... (PNG)

rodrigograca31 commented 5 years ago

I'm performing some tests and the results are promising.

Saving 3 images. First 3 lines are milliseconds taken to save in jpeg and next 3 are milliseconds taken to save in png like now. image

rodrigograca31 commented 5 years ago

It's almost implemented. Will finish tomorrow night and test and commit....

rodrigograca31 commented 5 years ago

@ataylor32 please test it and give me some feedback if everything is ok.

ataylor32 commented 5 years ago

I haven't tested on iOS yet, but I tested on Android and it worked fine. Thank you very much!

rodrigograca31 commented 5 years ago

ooooooooooops!

I totally forgot about iOS..... I don't know Swift or whatever so.........

Probably better to reopen this issue and tag it as "iOS help needed"

Thoughts?

ataylor32 commented 5 years ago

I believe it's actually Objective-C. I'm not familiar with it myself, but I looked at the code. There's significantly less code compared to Android. I didn't see anything about image format, so maybe it detects the format with magic and does the right thing. So maybe it will just work. I'll test it at some point and let you know how it goes.

rodrigograca31 commented 5 years ago

Yeah, Objective-C.

Yeah it should just work.... Unless me passing an extra argument messes with something....

P.S. @ataylor32 would you mind staring this repo? Thanks.

ataylor32 commented 5 years ago

Starred

rodrigograca31 commented 5 years ago

Thanks. It's so that this repo gets more visibility. I was even thinking making it a stand alone repo instead of a fork and renaming the plugin and publishing to npm....

ataylor32 commented 5 years ago

I was able to test on iOS today and both image formats work just fine.

rodrigograca31 commented 5 years ago

:+1: yeah, it doesnt have effect.... it will save in whatever format iOS saves....