0

I am trying to combine two jpeg file in my application and make it one Jpeg file. By Googling i got many example. but all example works with the bitmap image so I'm helpless.

I am using one jpeg image that is captured by the camera and the Second one is available in my drawable dir. Any idea how to do this? If is it possible then please give me some code to implement it. Thanks.

Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188
  • r u saying like joining them? or copying them on onanother? – mayank_droid Oct 14 '11 at 11:54
  • if u want to use it like layer on layer then you can simply take the drawable image as a canvas and draw the image from whereever you want and draw it on canvas – mayank_droid Oct 14 '11 at 11:56
  • It seems to me that he is trying to [combine](http://stackoverflow.com/questions/7764031/how-to-combine-the-green-transperent-canvas-with-the-camera-captured-image-before) [a camera](http://stackoverflow.com/questions/7763026/how-to-bind-any-image-with-the-captured-camera-image-before-saving-it) [picture with a](http://stackoverflow.com/questions/7753251/how-to-bind-the-transperent-green-image-or-transperent-green-canvas-effect-during) [green overlay](http://stackoverflow.com/questions/7751853/is-it-possible-to-snap-the-photo-with-overlay-canvas-effect-in-android). –  Oct 14 '11 at 11:57
  • I mean i have One Jpeg image that is of captured image. now i want to give some what coloue effect by combine the colour image with that image. or if possible to do Some colour effect directly to that Image then also i want to do it. – Shreyash Mahajan Oct 14 '11 at 11:58
  • @mak_just4anything : I mean i am copy them on oneanother. Somewhat like overlaying. – Shreyash Mahajan Oct 14 '11 at 12:00
  • @mak_just4anything : am i able to take the jpeg image in canvas and do effect on it ??? – Shreyash Mahajan Oct 14 '11 at 12:03
  • @alextsc : Yes, You are right Dear. But i am not able to get the Sollution thats why i done like this. – Shreyash Mahajan Oct 14 '11 at 12:04
  • just take a canvas with drawing your image on that..now wat u have to do is draw the image that you want to overlay something like frame on image..draw it on canvas again and it will overlay the previous image but be sure about the pixels of both images are same and you are done no need to use make any classes.... – mayank_droid Oct 14 '11 at 12:55
  • @mak_just4anything : is there any help of code please ? as i realy stuch with this to implement it. – Shreyash Mahajan Oct 14 '11 at 13:14
  • this is the same example as venky gave...and u have to convert the jpegs into bitmap and its not that hard.. – mayank_droid Oct 14 '11 at 14:00

2 Answers2

1

you can use jpeg.dll to decompress/compress jpeg images. without decompressing, you can't make any changes/additions on jpeg images.

steps are:

1) read and decompress jpeg files

2) do changes on uncompressed RGB buffers

3) compress as jpeg and save file

edit: I missed it was Android platform. For Android platform you need to use its SDK like the link below:

http://code.google.com/p/jjil/source/browse/trunk/JJIL-Android/src/jjil/android/RgbImageAndroid.java?r=282

Emir Akaydın
  • 5,708
  • 1
  • 29
  • 57
  • U mean if i want to do Some colour effect on that jpeg image then is it possible. for example, if i want to Give Some Green Transperent colour to the save jpeg image then is it Possible ?? If yes then is there any code or example to implement it ? as i am new to do this. – Shreyash Mahajan Oct 14 '11 at 11:57
  • you cannot change a single pixel of a jpeg image without decompessing it. maybe you can do this visually with some overlay effects but if you want to change the jpeg file itself, you need to decompress it, change and re-compress the buffer. to do this on android platform you can use this to save an RGB image as JPEG: http://code.google.com/p/jjil/source/browse/trunk/JJIL-Android/src/jjil/android/RgbImageAndroid.java?r=282 you will also need an example for JPEG>RGB of course. – Emir Akaydın Oct 14 '11 at 12:01
  • I have refer this example but I am not getting what is RgbImage ? in that example that class is imported as import jjil.core.RgbImage; – Shreyash Mahajan Oct 14 '11 at 12:31
  • I think I have to put many classes to implement it. Is there any library to do it ??? – Shreyash Mahajan Oct 14 '11 at 12:42
0

Check this post for Combining two images and stores in SDcard :

Combining Images

Venky
  • 11,049
  • 5
  • 49
  • 66