(echo "P5 512 4096 255"; cat ./foo.bin) > foo.pgm- https://dreampuf.github.io/GraphvizOnline
- https://manpages.debian.org/testing/graphviz/gvpr.1.en.html
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
alert(gl.getShaderInfoLog(shader));
}void main() {
float bug = 0.0;
vec3 tile = texture2D(colMap, coords.st).xyz;
vec4 col = vec4(tile, 1.0);
if (crash) {
bug = 1.0;
}
col.x += bug;
gl_FragColor = col;
}- ~/code/guides/ctf/write-ups-2015/pragyan-ctf-2015/misc/255_255_255_is_the_best_color/go.py
ffmpeg -framerate 75 -i 'input%04d0000.png' output.gif
# `-delay n`: 100/n FPS
# `-loop 0`: repeat forever
convert -delay 2 -loop 0 input*.png output.gif# SVG to PNG
for i in *.svg ; do inkscape -z -f "${i}" -w48 -h48 -e "${i%.svg}.png" ; done
# PhotoCD (PCD) to PNG
# FIXME: Low brightness using `-colorspace RGB`
find . -name "*.pcd" -type f -exec convert '{}[5]' ../../pngs/'{}'.png \;
# Alternatives:
g++ main.cpp pcdDecode.cpp -ljpeg -lpthread -o pcdtojpeg
find . -name "*.pcd" -type f -exec pcdtojpeg -r 5 '{}' \;
# PDF to JPEG
pdfimages -all foo.pdf ./out/
pdftoppm -tiff -r 300 foo.pdf ./out/pg
pdftoppm -jpeg -jpegopt quality=100 -r 300 foo.pdf ./out/pg
# LBM to PNG
ilbmtoppm foo.lbm | pnmtopng > foo.png{
# magic, width, height, max component value
echo "P3 250 250 255"
for ((y=0; y<250; y++)) {
for ((x=0; x<250; x++)) {
# r, g, b
echo "$((x^y)) $((x^y)) $((x|y))"
}
}
} | convert ppm:- png:- >foo.pngAlternatives:
- NetPBM:
pnmtopng < foo.ppm > foo.png
layer > transform > offset
duplicate layer gaussian blur invert colours layer tab > mode > overlay
duplicate layer gradient tool layer tab > mode > addition
https://orbitingweb.com/blog/optimizing-png-images/
# highlight differences
compare i1.png i2.png -metric RMSE o.png
# render differences
composite i1.png i2.png -compose difference o.pngimport numpy as np
from PIL import Image
data = np.zeros((2000,2000,4), dtype=np.uint8)
for i in range(100):
for j in range(100):
#modify_file("flag_{}_{}.jpg".format(i,j))
im = Image.open("flag_{}_{}.png".format(i,j))
array = np.array(im.getdata()).reshape(20,20,4)
data[20*i:20*(i+1), 20*j:20*(j+1)] = array
img = Image.fromarray(data, 'RGBA')
img.save('flag.png')montage -mode concatenate -tile 1x in-*.jpg out.jpg
# With padding
montage -tile 4x2 -geometry +2+2 -background none in-*.jpg out.jpghttps://superuser.com/questions/290656/combine-multiple-images-using-imagemagick
# 1366x768
convert in.png +repage -crop "$((1366-$((1366-752+2))))x$((768-$((768-464+26))))+1+26" out.png
# 1/3 of 1366x768
convert in.png +repage -crop "$((490-20-2))x$((736-10-34))+11+34" out.png
# multiple tiles
convert in.png +repage -crop 32x32 %04d.pngfor i in *.png; do convert -strip -quality 92% -resize x2600\> "$i" "$i".jpg; done- if scanned images, then use 2..5 degrees
- add control points
- preserving horizontal / vertical lines: same image on each side, 1st control point on one side, 2nd control point on other side, then optimize
- Hugin tutorial - Perspective correction
- How to stitch photos together on Linux
- preserve elements
- debugging
- if distinct colors across apps, then check:
- app color management enabled vs. disabled;
- system default ICC profile vs. app built-in ICC profile vs. embedded ICC profile;
identify -verbose in.png
# Remove ICC profile
convert -strip in.png out.png
# ||
ect -strip --strict in.png
# Add ICC profile
icc=$HOME/.local/share/icc/edid-01230123012301230123012301230123.icc; pngcrush -iccp $(wc -c "$icc" | awk '{print $1}') "Profile" "$icc" foo.png && mv pngout.png foo.png
# Edit ICC v2
dcamprof dcp2json foo.dcp foo.json
dcamprof make-icc -p matrix foo.json foo.icc
# Remove all exif metadata
exiftool -all= foo.jpg
# Remove all exif metadata except orientation
exiftool -all= -tagsfromfile @ -Orientation foo.jpg- python - selenium webdriver
save_screenshot()+ PillowImageChops.difference() - {!} changes in one element displace others => compute diff in DOM tree, style only changed elements
- GitHub - redecheck/redecheck: Automatically Detecting Layout Failures in Responsive Web Pages
- ~/Downloads/ReDeCheck - An Automatic Layout Failure Checking Tool for Responsively Designed Web Pages.pdf
- user-defined layout constraints checked against different viewports
convert image.bmp -depth 8 image.rgb
convert -size 512x512 -depth 8 image.rgb image.bmpconvert _ -filter point -resize 50% o50.png
# ||
convert _ -sample 50% o50.png
# With custom sampling point
# Reference: https://imagemagick.org/script/command-line-options.php#sample
convert _ -define sample:offset=75x25 -sample 50% o50.pngconvert -hald:16 hald_16.png
# [Apply transform with e.g. GIMP, take hald_16_processed.png]
convert foo.png hald_16_processed.png -hald-clut foo_processed.jpghttp://www.imagemagick.org/discourse-server/viewtopic.php?t=27719
With G'MIC plugin:
Details > Sharpening
- Richardson-Lucy Deconvolution
- Gold-Meinel Deconvolution
# Orientation values:
# - 1 = Horizontal (normal)
# - 2 = Mirror horizontal
# - 3 = Rotate 180
# - 4 = Mirror vertical
# - 5 = Mirror horizontal and rotate 270 CW
# - 6 = Rotate 90 CW
# - 7 = Mirror horizontal and rotate 90 CW
# - 8 = Rotate 270 CW
# References:
# - https://exiftool.org/TagNames/EXIF.html
exiftool -n -Orientation=8 -o output.jpg input.jpg
exiftool -n -Orientation="Rotate 270 CW" -o output.jpg input.jpgPerspective Tool
Filters > Distorts > Whirl and Pinch...
Frequency Domain Image Compression and Filtering | Hacker News
- ~/code/snippets/graphics/redpwnCTF2019-dedication.py
svgo foo.svg
pngquant --quality 40-60 -s1 --skip-if-larger -f foo.png && \
ect -9 --allfilters --pal_sort=20 --mt-deflate foo-fs8.png
# ||
mogrify -strip PNG8:foo.png
# ||
cwebp -psnr 40 foo.png -o foo.webp