INNER CODE UNIT · C++

image

7thSamurai/steganography · src/image.cpp:17

    image = std::make_unique<std::uint8_t[]>(x * y * 4);
    std::copy_n(buffer, x * y * 4, image.get());
    stbi_image_free(buffer);

    width  = x;
    height = y;

    return true;
}

bool Image::save(const std::string &path) {
    int result = stbi_write_png(path.c_str(), width, height, 4, image.get(), width * 4);

    return result != 0;
}

void Image::encode(const std::uint8_t *data, std::size_t size, EncodingLevel level, std::size_t offset) {
    auto image = this->image.get() + offset;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…