Crazelu / steganograph

A Dart library for hiding messages in images using Least Significant Bit steganography
Apache License 2.0
11 stars 3 forks source link

Add Method to only fetch orignal imagebytes without embeded message #5

Open sakshitporwal opened 1 week ago

sakshitporwal commented 1 week ago

If you try to use cloackBytes method on Uint8List which already contains a message It throws an error Image format not Supported

Crazelu commented 1 week ago

@sakshitporwal can you provide steps to reproduce this issue? I have tried with a slightly modified version of the example project and can't reproduce.

import 'dart:io';
import 'package:steganograph/steganograph.dart';

void main() async {
  final file = await Steganograph.cloak(
    image: File('example/assets/scribble.png'),
    message: "Insert some really top secret message here!",
    outputFilePath: 'example/assets/result.png',
  );

  final embeddedMessage = await Steganograph.uncloak(File(file!.path));

  print(embeddedMessage);

  final coverImage = File('example/assets/scribble.png');
  final coverImageBytes = await coverImage.readAsBytes();

  final stegoImageBytes = await Steganograph.cloakBytes(
    imageBytes: coverImageBytes,
    message: 'Some other secret message',
  );

  // calling cloakBytes on stegoImageBytes which already contains a message doesn't fail here
  final anotherStegoImageBytes = await Steganograph.cloakBytes(
    imageBytes: stegoImageBytes!,
    message: 'Yea yea',
  );

  final message = await Steganograph.uncloakBytes(stegoImageBytes);
  final anotherMessage = await Steganograph.uncloakBytes(
    anotherStegoImageBytes!,
  );

  print(message);
  print(anotherMessage);
}

How are you getting your Uint8List which already contains a message?