| Title: | R Bindings for PixPack - Encode Files into PNG Images |
|---|---|
| Description: | R bindings for PixPack, a utility that encodes arbitrary files and strings into PNG images with strong integrity checks using BLAKE3 hashing. Files can be encoded into visually distinctive PNG images and decoded back to recover the exact original data byte-for-byte. The underlying PixPack implementation uses a macro-cell grid format with error detection capabilities. |
| Authors: | SauersML [aut] (Original PixPack author), Sounkou Mahamane Toure [aut, cre] (Package maintainer and R bindings) |
| Maintainer: | Sounkou Mahamane Toure <[email protected]> |
| License: | MIT |
| Version: | 0.1.1 |
| Built: | 2026-05-19 08:55:59 UTC |
| Source: | https://github.com/sounkou-bioinfo/pixpack |
Encode a file to PixPack PNG or decode a PixPack PNG back to original file.
fileConversion(path)fileConversion(path)
path |
Input file path (character scalar). |
Output artifact path (character scalar).
This is a user-friendly wrapper around the core fileConversion function. It automatically detects whether to encode (file -> PNG) or decode (PNG -> file) based on the input file type.
pixpack_convert(file_path, verbose = TRUE)pixpack_convert(file_path, verbose = TRUE)
file_path |
Path to the input file. If it's a PNG created by PixPack, it will be decoded. Otherwise, it will be encoded into a PNG. |
verbose |
Logical; if TRUE, prints status messages |
Path to the output file (either the created PNG or decoded file)
## Not run: # Create a test file test_file <- tempfile(fileext = ".txt") writeLines(c("Hello", "World"), test_file) # Encode to PNG png_file <- pixpack_convert(test_file) # Decode back to original decoded_file <- pixpack_convert(png_file) # Clean up unlink(c(png_file, decoded_file, test_file)) ## End(Not run)## Not run: # Create a test file test_file <- tempfile(fileext = ".txt") writeLines(c("Hello", "World"), test_file) # Encode to PNG png_file <- pixpack_convert(test_file) # Decode back to original decoded_file <- pixpack_convert(png_file) # Clean up unlink(c(png_file, decoded_file, test_file)) ## End(Not run)
Extracts basic information about a file or PixPack PNG without decoding.
pixpack_info(file_path)pixpack_info(file_path)
file_path |
Path to the file to inspect |
A list with file information
## Not run: # Create test file test_file <- tempfile(fileext = ".txt") writeLines(c("Line 1", "Line 2"), test_file) # Get info info <- pixpack_info(test_file) print(info) # Clean up unlink(test_file) ## End(Not run)## Not run: # Create test file test_file <- tempfile(fileext = ".txt") writeLines(c("Line 1", "Line 2"), test_file) # Get info info <- pixpack_info(test_file) print(info) # Clean up unlink(test_file) ## End(Not run)
Creates a simple visualization showing the grid structure and metadata of a PixPack PNG file.
pixpack_plot(png_path, show_grid = TRUE)pixpack_plot(png_path, show_grid = TRUE)
png_path |
Path to a PixPack PNG file |
show_grid |
Logical; if TRUE, overlays a grid showing the data cells |
Invisibly returns a list with metadata (if extractable)
## Not run: # Create a test PNG test_text <- "Hello, PixPack!" png_file <- tempfile(fileext = ".png") pixpack_text(test_text, png_file) # Visualize it pixpack_plot(png_file) # Clean up unlink(png_file) ## End(Not run)## Not run: # Create a test PNG test_text <- "Hello, PixPack!" png_file <- tempfile(fileext = ".png") pixpack_text(test_text, png_file) # Visualize it pixpack_plot(png_file) # Clean up unlink(png_file) ## End(Not run)
User-friendly wrapper for encoding strings to PNG images or decoding them back.
pixpack_text(text = "", png_path, verbose = TRUE)pixpack_text(text = "", png_path, verbose = TRUE)
text |
Character string to encode (ignored if png_path exists and is a PixPack PNG) |
png_path |
Path where the PNG should be saved or read from |
verbose |
Logical; if TRUE, prints status messages |
If encoding: path to created PNG. If decoding: the decoded text.
## Not run: # Encode text to PNG png_file <- tempfile(fileext = ".png") result <- pixpack_text(text = "Hello, PixPack!", png_path = png_file) # Decode PNG back to text decoded_text <- pixpack_text(png_path = png_file) print(decoded_text) # Should print "Hello, PixPack!" # Clean up unlink(png_file) ## End(Not run)## Not run: # Encode text to PNG png_file <- tempfile(fileext = ".png") result <- pixpack_text(text = "Hello, PixPack!", png_path = png_file) # Decode PNG back to text decoded_text <- pixpack_text(png_path = png_file) print(decoded_text) # Should print "Hello, PixPack!" # Clean up unlink(png_file) ## End(Not run)
png_path already exists and is a PixPack PNG, it is decoded; otherwise input is encoded to that PNG path.Encode a string into a PixPack PNG at given path or decode an existing PixPack PNG to string.
If png_path already exists and is a PixPack PNG, it is decoded; otherwise input is encoded to that PNG path.
StringConversion(input, png_path)StringConversion(input, png_path)
input |
Character scalar (content when encoding; ignored on decode). |
png_path |
Target PNG path (must be provided). |
On encode: PNG path; On decode: decoded UTF-8 string (lossy).