0

I want complie two photos into one in javascript is there any code do that (it is not in the same domain)

so, the first image is the original and the second will be a logo

ManoDestra
  • 6,325
  • 6
  • 26
  • 50
anmml
  • 253
  • 3
  • 8
  • WHY duplicate? that question is totally different – anmml Jul 14 '16 at 10:57
  • Add more details to your question, i.e. how do you want to combine / compile ? them... – le_m Jul 14 '16 at 11:54
  • I mean the first image is the original and the second is a logo – anmml Jul 14 '16 at 13:34
  • Then this http://stackoverflow.com/questions/14742381/combining-multiple-images-to-one-on-html5-canvas might be of help – le_m Jul 14 '16 at 13:41
  • @le_m thank you. but I want it without canvas . – anmml Jul 14 '16 at 19:01
  • you can either overlay two (absolutely positioned) HTML image elements or create an (off-screen) canvas element and compose a new image on that (which you can then set as the source of another HTML image element). – le_m Jul 14 '16 at 19:11
  • @le_m I don't want to use any html, I just want to do it with javascript – anmml Jul 14 '16 at 19:16
  • Then - given your photos are given as either a base64 string, a binary string or an array buffer - you need to decode the image format (such as JPEG, PNG or BMP), merge the color channels e.g. by multiplication and encode again into your desired output format. There might be libraries available for that which bring their own en- and decoder. – le_m Jul 14 '16 at 21:39
  • @le_m thank you for help – anmml Jul 15 '16 at 09:21

1 Answers1

0

If you want to get the dataUri version of your canvas :

canvas.toDataURL();

More infos here. But be careful of the output size.

Ugo T.
  • 1,068
  • 8
  • 12