Small Lib for basic Image processing. Programmed in Pharo for Pharo :)
Metacello new
baseline: #ImageForm;
repository: 'github://pablo1n7/ImageForm/src';
load.
anImage := ImageForm open: '/Users/sdas/Documents/pwq7S.jpg'.
anImage show: 'Eileen Collins'.
aScaledImage save:'/Users/pablo/Documents/Pharo/pwq7S_scaled.jpg'.
aScaledImage save:'/Users/pablo/Documents/Pharo/pwq7S_scaled.png'.
aGrayImage := anImage asGrayScale
or
aGrayImage := ImageFormGrayScale open: '/Users/sdas/Documents/pwq7S.jpg'.
aLighterImage := anImageForm lighter:0.25.
aDarkerImage := anImageForm darker:0.25.
aNegatedImage := anImage negated .
aFlippedImage := anImage flipHorizontally.
aFlippedImage := anImage flipVertically.
aRotatedImage := anImage rotateBy: 45.
aRotatedImage := anImage rotateBy: #left centerAt: 0@0.
aScaledImage := anImageA scaled: 100 height: 100.
aCroppedImage := anImageForm crop: 0@0 h: 300 w: 500.
anImageA := ImageForm open: '/Users/sdas/Documents/pwq7S.jpg'.
anImageB := ImageForm open: '/Users/sdas/Documents/pharo.png'.
aSubResult := anImageB - anImageA.
aSumResult := anImageB + anImageA.
anImage := ImageForm open: '/Users/pablo/Documents/pharo/pharo.png'.
aGaussianKernel := {{ 1/256. 4/256. 6/256. 4/256. 1/256. }.
{ 4/256. 16/256. 24/256. 16/256. 4/256.}.
{ 6/256. 24/256. 36/256. 24/256. 6/256. }.
{ 4/256. 16/256. 24/256. 16/256. 4/256. }.
{ 1/256. 4/256. 6/256. 4/256. 1/256. }.}.
aResult := anImage applyKernel: aGaussianKernel flattened .
anImage := ImageForm open: '/Users/pablo/Documents/pharo/pharo.png'.
aGrayImage := anImage asGrayScale.
aSobelKernel := {{-0.1. -0.1. -0.1}.
{ -0.1. 0.80. -0.1}.
{-0.1. -0.1. -0.1}}.
aResult := aGrayImage applyKernel: aSobelKernel flattened .
anImage := ImageForm open: '/Users/pablo/Documents/pharo/icon.png'.
aGrayImage := anImage asGrayScale.
aBinaryImage := aGrayImage asBinaryImage: 0.1.
anErosionImage := aBinaryImage erosion: ImageFormGrayScale squareKernel3x3 iterations: 6.
anDilationImage := aBinaryImage dilation: ImageFormGrayScale squareKernel3x3 iterations: 6.