flutter_steganograph 0.1.0 copy "flutter_steganograph: ^0.1.0" to clipboard
flutter_steganograph: ^0.1.0 copied to clipboard

A package that embeds a message (text or image) into a (cover image/text) using the least significant bit (LSB) & Zero-width techniques with minimal alteration to the original cover image or text.

example/example.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_steganograph/flutter_steganograph.dart';
// ignore: library_prefixes
import 'package:image/image.dart' as dImage;

void main() async {
  final steganograph = Steganograph();
  String path1 = "example/assets/plant1.png";
  String path2 = "example/assets/plant2.png";

  String coverText = "This is a cover text.";
  String secretMessage = "Hello, secret!";

  // Embedding the secret message
  String embeddedText = steganograph.embedTextInText(coverText: coverText, secretMessage: secretMessage);
  print("Embedded Text: $embeddedText");

  // Extracting the secret message
  String extractedMessage = steganograph.extractTextFromText(encodedText: embeddedText);
  print("Extracted Message: $extractedMessage");

  //Embed text in an image
  final coverImageText = dImage.decodePng(File(path1).readAsBytesSync())!;
  String textInput = "my_secret_plant_name";
  final embeddedTextImage = steganograph.embedText(image: coverImageText, text: textInput);
  Image.memory(embeddedTextImage); // convert bytes to material image to display

  //Extract text string from encoded image
  final imageToExtractFrom =  dImage.decodePng(embeddedTextImage)!;
  steganograph.extractText(image: imageToExtractFrom, length: textInput.length);

  //Embed plant1 image inside plant2 image
  final coverImage = dImage.decodePng(File(path1).readAsBytesSync())!;
  final secretImage = dImage.decodeImage(File(path2).readAsBytesSync())!;
  final embeddedImageCover = steganograph.embedImage(coverImage: coverImage, secretImage: secretImage);
  Image.memory(embeddedImageCover); // convert bytes to material image to display

  //Extract plant1 image from encoded image 
  final coverToExtractFrom =  dImage.decodePng(embeddedImageCover)!;
  final extractedSecretImage = steganograph.extractImage(embeddedImage: coverToExtractFrom, secretWidth: secretImage.width, secretHeight: secretImage.height);
  Image.memory(extractedSecretImage); // convert bytes to material image to display

}
7
likes
130
pub points
45%
popularity

Publisher

unverified uploader

A package that embeds a message (text or image) into a (cover image/text) using the least significant bit (LSB) & Zero-width techniques with minimal alteration to the original cover image or text.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, gal, image, image_picker, path, path_provider

More

Packages that depend on flutter_steganograph