-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modules/png (bytevector->png-image): New procedure
* modules/png.scm (bytevector->png-image): New procedure. * tests/image.scm ("bytevector->png-image"): New test.
- Loading branch information
1 parent
f1b7a5e
commit 7735fb6
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;; png.scm -- GNU Guile PNG parser. | ||
|
||
;; Copyright (C) 2022 Artyom V. Poptsov <[email protected]> | ||
;; Copyright (C) 2022-2024 Artyom V. Poptsov <[email protected]> | ||
;; | ||
;; This program is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
|
@@ -27,13 +27,15 @@ | |
|
||
(define-module (png) | ||
#:use-module (oop goops) | ||
#:use-module (rnrs io ports) | ||
#:use-module (png image) | ||
#:use-module (png fsm context) | ||
#:use-module (png fsm png-context) | ||
#:use-module (png fsm png-parser) | ||
#:use-module (png core chunk) | ||
#:use-module (png chunk-decoder) | ||
#:export (png->scm | ||
bytevector->png-image | ||
scm->png)) | ||
|
||
|
||
|
@@ -58,6 +60,18 @@ | |
(png-compressed-image-decompress image remove-filter?) | ||
image))))) | ||
|
||
(define* (bytevector->png-image bv | ||
#:key | ||
(decompress? #t) | ||
(debug-mode? #f) | ||
(remove-filter? #t)) | ||
"Convert a bytevector @var{bv} to a PNG image. return the new image." | ||
(with-input-from-port (open-bytevector-input-port bv) | ||
(lambda () | ||
(png->scm #:decompress? decompress? | ||
#:debug-mode? debug-mode? | ||
#:remove-filter? remove-filter?)))) | ||
|
||
(define* (scm->png image | ||
#:optional | ||
(port (current-output-port))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters