syvaidya / openstego

OpenStego is a steganography application that provides two functionalities: a) Data Hiding: It can hide any data within an image file. b) Watermarking: Watermarking image files with an invisible signature. It can be used to detect unauthorized file copying.
https://www.openstego.com
GNU General Public License v2.0
1.15k stars 212 forks source link

Watermarking never works #3

Closed vitalyrepin closed 8 years ago

vitalyrepin commented 8 years ago

Hello,

I was not able to make any watermarks. It always ended with error messages.

Steps to reproduce: 1) generate signature file. I used passphrase "Test" and managed to generate it successfully. (attached) 2) Download image file: http://farm1.staticflickr.com/616/21598757660_12000ec088_o_d.png (if it is not opening I can publish this image in my web server, let me know) 3) Try to create digital watermark using the image (step 2) and the sig. file (step 1).

Expected outcome: new file with watermark is created

Real outcome: no file is created and the following Java errors are displayed:

Caused by: java.lang.OutOfMemoryError: Java heap space at net.sourceforge.openstego.util.dwt.Image.(Image.java:37) at net.sourceforge.openstego.util.dwt.DWT.forwardDWT(DWT.java:99) at net.sourceforge.openstego.plugin.dwtdugad.DWTDugadPlugin.embedData(DWTDugadPlugin.java:126) at net.sourceforge.openstego.OpenStego.embedMark(OpenStego.java:213) at net.sourceforge.openstego.OpenStego.embedMark(OpenStego.java:257) at net.sourceforge.openstego.ui.OpenStegoUI$3.doInBackground(OpenStegoUI.java:604) at javax.swing.SwingWorker$1.call(SwingWorker.java:296) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at javax.swing.SwingWorker.run(SwingWorker.java:335) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at net.sourceforge.openstego.ui.OpenStegoUI$3.done(OpenStegoUI.java:635) at javax.swing.SwingWorker$5.run(SwingWorker.java:737) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832) at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842) at javax.swing.Timer.fireActionPerformed(Timer.java:312) at javax.swing.Timer$DoPostEvent.run(Timer.java:244) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745) at java.awt.EventQueue.access$300(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:706) at java.awt.EventQueue$3.run(EventQueue.java:704) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:715) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Any idea how can it be fixed? I was not able to find an image in my collection which I can sign :-( Always out-of-memory errors. I have tried jpg also.

OpenStego v0.6.1 was used.

vitalyrepin commented 8 years ago

test.sig is attached (txt extension is added in order to be able to attach it using github issues mechanism

test.sig.txt )

syvaidya commented 8 years ago

In "openstego.bat" (openstego.sh, if you are on Linux) file, increase the Xmx value.

For example:

@java -Xmx1024m -jar "%~dp0\lib\openstego.jar" %*
vitalyrepin commented 8 years ago

Confirming that it started to work after modifying cmdline in openstego.sh:

java -Xmx10240m -jar ${DIR}/lib/openstego.jar $*

Thanks!

vitalyrepin commented 8 years ago

Just a side question - after successful watermarking the image quality is degraded and exif tags are removed.

E.g., my original image:

/mnt/flash/final/final/DSC01693_bw.jpg: JPEG image data, Exif standard: [TIFF image data, little-endian, direntries=19, height=4032, bps=242, PhotometricIntepretation=RGB, orientation=upper-left, width=6048], baseline, precision 8, 6048x4032, frames 3

Watermarked image: /tmp/final/DSC01693_bw.jpg: JPEG image data, JFIF standard 1.02, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 6048x4032, frames 3

Difference is sizes: 9.5M (original) versus 1.5M (watermarked)

Which source shall I look into to change this behaviour?

vitalyrepin commented 8 years ago

Workaround: use png as an output format. And apply exif tags after appying watermarks.