GJNilsen/YPDrawSignatureView

Closed Regions Filled/Shaded when Saving Signature

Closed this issue · 3 comments

aguel commented

I have a very basic code:

let image = signPad.getSignature()!
let imageData = UIImagePNGRepresentation(image)

The resulting saved/uploaded image seems to fill/shade any close regions in the signature. See result below:

AS SIGNED (ORIGINAL):
original

RESULT:
result

I used the sample app, and could not recreate the error you have encountered.
I altered the code in the save signature function, and added code that is close to your code
// Gets the signature of type UIImage from the signature view let testsignature = self.signatureView.getSignature() // converts the testsignature of type UIImage to NSData let pngimage = UIImagePNGRepresentation(testsignature!) // converts the data representation back to an UIImage let image = UIImage(data: pngimage!)
So I made some doodles in the altered test project
screen shot 2016-09-23 at 14 18 18
I tapped Save signature, and I QuickLooked the image variable.
screen shot 2016-09-23 at 14 18 48
As you can see, the output image converted to and later from NSData is correct. The code published on Github is working as intended, so you have either 1. stale YPDrawSignature code, 2. customised it and introduced the bug yourself, or 3. some weird stuff going on. ;)

So my advice is for you to add
let debugImage = UIImage(data: imageData) right after your code, and a breakpoint right after that. Now you can QuickLook the let debugImage, and the image should be correct.
If it is correct, you have manipulated that data further down the line, and have to debug it there.
If it is incorrect, and you have customised the YPDrawSignatureView code, you have almost certain added the bug during this customisation, and have to debug it there.
If it is incorrect, and you have fresh code from this repository, get back to me and we have to get to the bottom of the problem.

aguel commented

Thanks. Closing the ticket. I think it has something to do with my upload handler (PHP).

Ok. I can ask one of our back-end guys to help if you have problems with the php-related stuff.