Zautomatyzuj ukrywanie sekretnych danych w obrazkach i zdjęciach z użyciem pakietu Web API SDK Steganografia Kodek Online.
Możesz skorzystać ze wszystkich funkcji Steganografia Kodek Online poprzez nasz interfejs Web API. Interfejs Web API bazuje na zapytaniu POST i zwraca wynik zakodowany jako JSON.
Dla szybszego wdrożenia możesz zainstalować pakiety SDK poprzez popularne repozytoria bibliotek dla wybranych języków programowania. Kody źródłowe są także dostępne na Githubie:
| Repozytorium | Język | Instalacja | Pakiet | Źródła |
|---|---|---|---|---|
![]() |
Python | pip install steganography-online-codec |
PyPI | GitHub |
![]() |
JavaScript | Run
lub dodaj do sekcji |
npm | GitHub |
#!/usr/bin/env python
###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# This example shows how to hide an encrypted secret message in an image file.
#
# Version : v1.00
# Language : Python
# Author : Bartosz Wójcik
# Project : https://www.pelock.com/products/steganography-online-codec
# Homepage : https://www.pelock.com
#
###############################################################################
#
# include Steganography Online Codec module
#
from steganography_online_codec import *
#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")
#
# encode a hidden message (encrypted with your password) within an image file
#
result = mySteganographyOnlineCodec.encode("input_file.jpg", "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png")
#
# result[] array holds the encoding results as well as other information
#
if result and "error" in result:
if result["error"] == Errors.SUCCESS:
print(f'Secret messaged encoded and saved to the output PNG file.')
else:
print(f'Error code {result["error"]}')
else:
print("Something unexpected happen while trying to encode the message.")
"use strict";
/******************************************************************************
*
* Steganography Online Codec WebApi interface usage example.
*
* In this example shows how to hide an encrypted secret message in an image file.
*
* Version : v1.00
* Language : JavaScript
* Author : Bartosz Wójcik (original example)
* Project : https://www.pelock.com/products/steganography-online-codec
* Homepage : https://www.pelock.com
*
* @link https://www.pelock.com/products/steganography-online-codec
* @copyright Copyright (c) 2020-2025 PELock LLC
* @license Apache-2.0
*
/*****************************************************************************/
// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';
// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');
// encode a hidden message (encrypted with your password) within an image file
(async () => {
const inputFile = 'input_file.jpg';
const secretMessage = 'Secret message';
const password = 'Pa$$word';
const outputFile = 'output_file_with_hidden_secret_message.png';
try {
const result = await mySteganographyOnlineCodec.encode(inputFile, secretMessage, password, outputFile);
// result object holds the encoding results as well as other information
console.log('Secret messaged encoded and saved to the output PNG file.');
} catch (err) {
console.error('Encoding failed:', err.error_message || err.message || String(err));
}
})();
#!/usr/bin/env python
###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example, we will see how to extract a previously encrypted & hidden
# secret message from an image file.
#
# Version : v1.00
# Language : Python
# Author : Bartosz Wójcik
# Project : https://www.pelock.com/products/steganography-online-codec
# Homepage : https://www.pelock.com
#
###############################################################################
#
# include Steganography Online Codec module
#
from steganography_online_codec import *
#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *
#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")
#
# extract a hidden message from the previously encoded image file
#
# full version image size limit is set to 10 MB (demo 50 kB max)
# supported image format is PNG and only PNG!
input_file_path = "output_file_with_hidden_secret_message.png"
# full version password length is 128 characters max (demo 8 chars max)
password = "Pa$$word"
# extract a hidden message from the image (PNG files only)
result = mySteganographyOnlineCodec.decode(input_file_path, password)
#
# result[] Dict holds the decoding results as well as other information
#
if result and "error" in result:
print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')
if result["error"] == Errors.SUCCESS:
print(f'Secret message is "{result["message"]}"')
print(f'Remaining number of usage credits - {result["license"]["usagesCount"]}')
elif result["error"] == Errors.INVALID_INPUT:
print(f'Invalid input file {input_file_path} or file doesn''t exist')
elif result["error"] == Errors.IMAGE_TOO_BIG:
print(f'Image file is too big, current limit is set to {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
elif result["error"] == Errors.LIMIT_MESSAGE:
print(f'Extracted message is too long, current limit is set to {result["limits"]["maxMessageLen"]}')
elif result["error"] == Errors.LIMIT_PASSWORD:
print(f'Password is too long, current limit is set to {result["limits"]["maxPasswordLen"]}')
elif result["error"] == Errors.INVALID_PASSWORD:
print(f'Invalid password')
else:
print(f'An unknown error occurred, error code: {result["error"]}')
else:
print("Something unexpected happen while trying to extract the secret message.")
"use strict";
/******************************************************************************
*
* Steganography Online Codec WebApi interface usage example.
*
* In this example, we will see how to extract a previously encrypted & hidden
* secret message from an image file.
*
* Version : v1.00
* Language : JavaScript
* Author : Bartosz Wójcik
* Project : https://www.pelock.com/products/steganography-online-codec
* Homepage : https://www.pelock.com
*
* @link https://www.pelock.com/products/steganography-online-codec
* @copyright Copyright (c) 2020-2025 PELock LLC
* @license Apache-2.0
*
/*****************************************************************************/
// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';
// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');
// extract a hidden message from the previously encoded image file
(async () => {
// full version image size limit is set to 10 MB (demo 50 kB max)
// supported image format is PNG and only PNG!
const inputFilePath = 'output_file_with_hidden_secret_message.png';
// full version password length is 128 characters max (demo 8 chars max)
const password = 'Pa$$word';
try {
// extract a hidden message from the image (PNG files only)
const result = await mySteganographyOnlineCodec.decode(inputFilePath, password);
// result object holds the decoding results as well as other information
console.log(`You are running in ${result.license?.activationStatus ? 'full' : 'demo'} version`);
console.log(`Secret message is "${result.message}"`);
if (result.license && result.license.usagesCount !== undefined) {
console.log(`Remaining number of usage credits - ${result.license.usagesCount}`);
}
} catch (err) {
switch (err.error) {
case Errors.INVALID_INPUT:
console.log(`Invalid input file ${inputFilePath} or file doesn't exist`);
break;
case Errors.IMAGE_TOO_BIG:
console.log(`Image file is too big, current limit is set to ${err.raw?.limits?.maxFileSize ?? 'unknown'}`);
break;
case Errors.LIMIT_MESSAGE:
console.log(`Extracted message is too long, current limit is set to ${err.raw?.limits?.maxMessageLen ?? 'unknown'}`);
break;
case Errors.LIMIT_PASSWORD:
console.log(`Password is too long, current limit is set to ${err.raw?.limits?.maxPasswordLen ?? 'unknown'}`);
break;
case Errors.INVALID_PASSWORD:
console.log('Invalid password');
break;
default:
console.log(`An error occurred: ${err.error_message ?? String(err)}`);
}
}
})();
#!/usr/bin/env python
###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example, we will see how to hide an encrypted message in an
# image file using our codec.
#
# Version : v1.00
# Language : Python
# Author : Bartosz Wójcik
# Project : https://www.pelock.com/products/steganography-online-codec
# Homepage : https://www.pelock.com
#
###############################################################################
#
# include Steganography Online Codec module
#
from steganography_online_codec import *
#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *
#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")
#
# encode a hidden message within the source image file
#
# full version image size limit is set to 10 MB (demo 50 kB max)
# supported image formats are PNG, JPG, GIF, BMP, WBMP, GD2, AVIF, WEBP (mail me for more)
input_file_path = "input_file.webp"
# full version message size is unlimited (demo 16 chars max)
secret_message = "Secret message"
# full version password length is 128 characters max (demo 8 chars max)
password = "Pa$$word"
# where to save encoded image with the secret message
output_file_path = "output_file_with_hidden_secret_message.png"
# encode a hidden message (encrypted with your password) within an image file
result = mySteganographyOnlineCodec.encode(input_file_path, secret_message, password, output_file_path)
#
# result[] array holds the encoding results as well as other information
#
if result and "error" in result:
print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')
if result["error"] == Errors.SUCCESS:
print(f'Secret messaged encoded and saved to {output_file_path}')
print(f'Remaining number of usage credits - {result["license"]["usagesCount"]}')
elif result["error"] == Errors.INVALID_INPUT:
print(f'Invalid input file {input_file_path} or file doesn''t exist')
elif result["error"] == Errors.MESSAGE_TOO_LONG:
print(f'Message is too long for the provided image file, use larger file')
elif result["error"] == Errors.IMAGE_TOO_BIG:
print(f'Image file is too big, current limit is set to {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
elif result["error"] == Errors.LIMIT_MESSAGE:
print(f'Message is too long, current limit is set to {result["limits"]["maxMessageLen"]}')
elif result["error"] == Errors.LIMIT_PASSWORD:
print(f'Password is too long, current limit is set to {result["limits"]["maxPasswordLen"]}')
elif result["error"] == Errors.INVALID_PASSWORD:
print(f'Invalid password')
else:
print(f'An unknown error occurred, error code: {result["error"]}')
else:
print("Something unexpected happen while trying to encode the message.")
"use strict";
/******************************************************************************
*
* Steganography Online Codec WebApi interface usage example.
*
* In this example, we will see how to hide an encrypted message in an
* image file using our codec.
*
* Version : v1.00
* Language : JavaScript
* Author : Bartosz Wójcik
* Project : https://www.pelock.com/products/steganography-online-codec
* Homepage : https://www.pelock.com
*
* @link https://www.pelock.com/products/steganography-online-codec
* @copyright Copyright (c) 2020-2025 PELock LLC
* @license Apache-2.0
*
/*****************************************************************************/
// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';
// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');
// encode a hidden message within the source image file
(async () => {
// full version image size limit is set to 10 MB (demo 50 kB max)
// supported image formats are PNG, JPG, GIF, BMP, WBMP, GD2, AVIF, WEBP (mail me for more)
const inputFilePath = 'input_file.webp';
// full version message size is unlimited (demo 16 chars max)
const secretMessage = 'Secret message';
// full version password length is 128 characters max (demo 8 chars max)
const password = 'Pa$$word';
// where to save encoded image with the secret message
const outputFilePath = 'output_file_with_hidden_secret_message.png';
try {
// encode a hidden message (encrypted with your password) within an image file
const result = await mySteganographyOnlineCodec.encode(inputFilePath, secretMessage, password, outputFilePath);
// result object holds the encoding results as well as other information
const versionType = result.license && result.license.activationStatus ? 'full' : 'demo';
console.log(`You are running in ${versionType} version`);
console.log(`Secret messaged encoded and saved to ${outputFilePath}`);
if (result.license && result.license.usagesCount !== undefined) {
console.log(`Remaining number of usage credits - ${result.license.usagesCount}`);
}
} catch (err) {
const errorCode = err.error;
switch (errorCode) {
case Errors.INVALID_INPUT:
console.log(`Invalid input file ${inputFilePath} or file doesn't exist`);
break;
case Errors.MESSAGE_TOO_LONG:
console.log('Message is too long for the provided image file, use larger file');
break;
case Errors.IMAGE_TOO_BIG:
console.log(`Image file is too big, current limit is set to ${err.raw?.limits?.maxFileSize ?? 'unknown'}`);
break;
case Errors.LIMIT_MESSAGE:
console.log(`Message is too long, current limit is set to ${err.raw?.limits?.maxMessageLen ?? 'unknown'}`);
break;
case Errors.LIMIT_PASSWORD:
console.log(`Password is too long, current limit is set to ${err.raw?.limits?.maxPasswordLen ?? 'unknown'}`);
break;
case Errors.INVALID_PASSWORD:
console.log('Invalid password');
break;
default:
console.log(`An error occurred: ${err.error_message ?? `Error code ${errorCode}`}`);
}
}
})();
#!/usr/bin/env python
###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example we will verify our activation key status.
#
# Version : v1.00
# Language : Python
# Author : Bartosz Wójcik
# Project : https://www.pelock.com/products/steganography-online-codec
# Homepage : https://www.pelock.com
#
###############################################################################
#
# include Steganography Online Codec module
#
from steganography_online_codec import *
#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *
#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")
#
# login to the service
#
result = mySteganographyOnlineCodec.login()
#
# result[] Dict holds the information about the license & current limits
#
if result:
print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')
# information about the current license
if result["license"]["activationStatus"] is True:
print(f'Registered for - {result["license"]["userName"]}')
print(f'License type - {"personal" if result["license"]["type"] == 0 else "company"}')
print(f'Total number of purchased usage credits - {result["license"]["usagesTotal"]}')
print(f'Remaining number of usage credits - {result["license"]["usagesCount"]}')
# current limits (different for DEMO and FULL versions)
print(f'Max. password length - {result["limits"]["maxPasswordLen"]}')
print(f'Max. message length - {"unlimited" if result["limits"]["maxMessageLen"] == -1 else result["limits"]["maxMessageLen"]}')
print(f'Max. input image file size - {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
else:
print("Something unexpected happen while trying to login to the service.")
"use strict";
/******************************************************************************
*
* Steganography Online Codec WebApi interface usage example.
*
* In this example we will verify our activation key status.
*
* Version : v1.00
* Language : JavaScript
* Author : Bartosz Wójcik
* Project : https://www.pelock.com/products/steganography-online-codec
* Homepage : https://www.pelock.com
*
* @link https://www.pelock.com/products/steganography-online-codec
* @copyright Copyright (c) 2020-2025 PELock LLC
* @license Apache-2.0
*
/*****************************************************************************/
// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';
// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');
// login to the service
(async () => {
try {
const result = await mySteganographyOnlineCodec.login();
// result object holds the information about the license & current limits
const versionType = result.license && result.license.activationStatus ? 'full' : 'demo';
console.log(`You are running in ${versionType} version`);
// information about the current license
if (result.license && result.license.activationStatus) {
console.log(`Registered for - ${result.license.userName}`);
const licenseType = result.license.type === 0 ? 'personal' : 'company';
console.log(`License type - ${licenseType}`);
console.log(`Total number of purchased usage credits - ${result.license.usagesTotal}`);
console.log(`Remaining number of usage credits - ${result.license.usagesCount}`);
}
// current limits (different for DEMO and FULL versions)
if (result.limits) {
console.log(`Max. password length - ${result.limits.maxPasswordLen}`);
const msgLen = result.limits.maxMessageLen === -1 ? 'unlimited' : result.limits.maxMessageLen;
console.log(`Max. message length - ${msgLen}`);
console.log(`Max. input image file size - ${mySteganographyOnlineCodec.convert_size(result.limits.maxFileSize)}`);
}
} catch (err) {
console.error(`Login failed: ${err.error_message || String(err)}`);
}
})();
result["error"] [out]| Nazwa | Wartość | Opis |
|---|---|---|
| WEBAPI_CONNECTION | -1 |
Nie można połączyć się z interfejsem Web API (błąd sieci, zwracany jedynie przez bibliotekę SDK). |
| SUCCESS | 0 |
Wszystko poszło ok. |
| UNKNOWN | 1 |
Nieznany błąd. |
| MESSAGE_TOO_LONG | 2 |
Wiadomość jest zbyt długa dla wybranego pliku obrazka (użyj większy plik obrazka). |
| IMAGE_TOO_BIG | 3 |
Plik obrazka zbyt duży (limit 10 MB dla pełnej wersji, 50 kB dla wersji DEMO). |
| INVALID_INPUT | 4 |
Plik obrazka jest nieprawidłowy. |
| INVALID_IMAGE_FORMAT | 5 |
Format pliku obrazka nie jest obsługiwany. |
| IMAGE_MALFORMED | 6 |
Plik obrazka jest uszkodzony lub nie można go odczytać albo zapisać do niego zakodowanej wiadomości. |
| INVALID_PASSWORD | 7 |
Podane hasło jest nieprawidłowe (maksymalny rozmiar hasła to 128 znaków dla pełnej wersji i 8 znaków dla wersji DEMO). |
| LIMIT_MESSAGE | 9 |
Wiadomość jest zbyt długa (nieograniczony rozmiar dla pełnej wersji, 16 znaków dla wersji DEMO). |
| LIMIT_PASSWORD | 10 |
Podane hasło ma nieprawidłowy rozmiar (rozmiar to maksymalnie 128 znaków dla pełnej wersji, 8 dla wersji DEMO). |
| OUTPUT_FILE | 99 |
Błąd podczas zapisywania wyjściowego pliku (zwracany jedynie przez bibliotekę SDK). |
| INVALID_LICENSE | 100 |
Klucz licencji jest nieprawidłowy lub wygasł (brak kredytów użycia). |
result["message"] [out, optional]result["limits"]["maxFileSize"] [out, optional]result["limits"]["maxMessageLen"] [out, optional]result["limits"]["maxPasswordLen"] [out, optional]result["license"]["activationStatus"] [out, optional]true dla pełnej wersji false dla wersji demo.result["license"]["userName"] [out, optional]result["license"]["type"] [out, optional]result["license"]["usagesTotal"] [out, optional]result["license"]["usagesCount"] [out]| Moduł dla Python | steganography-online-codec |
| JavaScript NPM Module | steganography-online-codec |
Jeśli masz jakieś pytania dotyczące pakietów SDK dla Steganografia Kodek Online, masz jakieś uwagi, coś jest niejasne, napisz do mnie, chętnie odpowiem na każde Twoje pytanie.