Skip to content

pablo1n7/ImageForm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

ImageForm

Small Lib for basic Image processing. Programmed in Pharo for Pharo :)

Install

Metacello new
  baseline: #ImageForm;
  repository: 'github://pablo1n7/ImageForm/src';
  load.

Basic Operations

Open an Image.

anImage := ImageForm open: '/Users/sdas/Documents/pwq7S.jpg'.

Show Image.

anImage show: 'Eileen Collins'.

Save Image.

aScaledImage save:'/Users/pablo/Documents/Pharo/pwq7S_scaled.jpg'.
aScaledImage save:'/Users/pablo/Documents/Pharo/pwq7S_scaled.png'.

Color Operations

Transform to Gray Scale.

aGrayImage := anImage asGrayScale 

or

aGrayImage := ImageFormGrayScale open: '/Users/sdas/Documents/pwq7S.jpg'.

Lighter Image.

aLighterImage := anImageForm lighter:0.25.

Darker Image.

aDarkerImage := anImageForm darker:0.25.

Negated Image.

aNegatedImage := anImage negated .

Image Transformations.

Flip Image.

aFlippedImage := anImage flipHorizontally.

aFlippedImage := anImage flipVertically.

Rotate Image.

aRotatedImage := anImage rotateBy: 45.

aRotatedImage := anImage rotateBy: #left centerAt: 0@0. 

Scale Image.

aScaledImage := anImageA scaled: 100 height: 100. 

Crop Image.

aCroppedImage := anImageForm crop: 0@0 h: 300  w: 500.

Basic Arithmetics.

anImageA := ImageForm open: '/Users/sdas/Documents/pwq7S.jpg'.
anImageB := ImageForm open: '/Users/sdas/Documents/pharo.png'.

aSubResult := anImageB - anImageA.

aSumResult := anImageB + anImageA.

Advanced Operations

Operations with kernels (3x3 and 5x5)

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 .

Gray Scale Operations

anImage := ImageForm open: '/Users/pablo/Documents/pharo/icon.png'.
aGrayImage := anImage asGrayScale.

Transform to Binary Image.

 aBinaryImage := aGrayImage asBinaryImage: 0.1.

Erosion.

anErosionImage := aBinaryImage erosion: ImageFormGrayScale squareKernel3x3 iterations: 6.

Dilation.

anDilationImage := aBinaryImage dilation: ImageFormGrayScale squareKernel3x3 iterations: 6.

About

Small Lib for basic Image processing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published