Skip to content
Snippets Groups Projects
Commit 5299036a authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

New 16-bit test images of fixed size

parent 2f98fb6e
No related branches found
No related tags found
No related merge requests found
// macro to generate a 1D image containing pixel values ranging
// from zero to the maximum possible value of the numbers given
// in the bit_depth array - for every bit depth specified there
// two pixels are added, one being (max - 1) and the second
// being the max value itself
bit_depths = newArray(0, 8, 9, 10, 11, 12, 14, 16);
range = newArray(lengthOf(bit_depths) * 2);
for (i = 0; i < lengthOf(bit_depths); i++) {
range[i*2] = pow(2, bit_depths[i]) - 2;
range[i*2+1] = pow(2, bit_depths[i]) - 1;
}
range[0] = 0;
Array.print(range);
title = "" + bit_depths[lengthOf(bit_depths)-1] + " bit test image";
newImage(title, "16 bit", lengthOf(range) - 1, 1, 1);
for (i = 1; i < lengthOf(range); i++) {
setPixel(i-1, 0, range[i]);
}
run("Set... ", "zoom=3200");
run("glasbey_on_dark");
// macro to generate 2D images containing pixels with the four highest
// values of the given bit depth (defined in the bit_depth array),
// followed by a zero value pixel (eventually rescaled to 160x32)
#@ File(label="Output directory",style="directory") gen_images_output_dir
bit_depths = newArray(8, 9, 10, 11, 12, 13, 14, 15, 16);
for (i = 0; i < lengthOf(bit_depths); i++) {
title = "" + bit_depths[i] + " bit 5px test image";
// print(title);
newImage(title, "16 bit", 5, 1, 1);
for (v = 0; v < 4; v++) {
val = pow(2, bit_depths[i]) - (1 + v);
setPixel(v, 0, val);
// print("pos / value: " + v + " / " + val);
}
setPixel(4, 0, 0);
run("Scale...", "x=32 y=32 width=160 height=32 interpolation=None create");
selectWindow(title);
close();
rename(title);
saveAs("Tiff", gen_images_output_dir + "/" + title + ".tif");
close();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment