-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves the docs for the Image module to mention read/write support [Reviewed by @DanilaFe]
- Loading branch information
Showing
6 changed files
with
45 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
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,2 +1,4 @@ | ||
*.bmp | ||
*.mp4 | ||
*.jpg | ||
*.png |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
output.jpg |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use Image; | ||
|
||
// create the input image | ||
{ | ||
var colors: [1..#3, 1..#3] 3*int; | ||
colors[1, ..] = [(0xFF,0,0), (0,0xFF,0), (0,0,0xFF)]; | ||
colors[2, ..] = [(0,0xFF,0), (0,0,0xFF), (0xFF,0,0)]; | ||
colors[3, ..] = [(0,0,0xFF), (0xFF,0,0), (0,0xFF,0)]; | ||
var pixels = colorToPixel(colors, format=(rgbColor.blue, rgbColor.green, rgbColor.red)); | ||
writeImage("input.png", imageType.png, pixels); | ||
} | ||
|
||
|
||
// | ||
// the second example from the Image module docs | ||
// | ||
var arr = readImage("input.png", imageType.png); | ||
const fmt = (rgbColor.red, rgbColor.green, rgbColor.blue); | ||
var colors = pixelToColor(arr, format=fmt); | ||
[c in colors] c(1) = 0; | ||
arr = colorToPixel(colors, format=fmt); | ||
writeImage("output.jpg", imageType.jpg, arr); | ||
|
||
|
||
// clean up file not needed | ||
use FileSystem; | ||
remove("input.png"); |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
output.jpg |
Binary file not shown.