Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pablo1n7/imageform
Small Lib for basic Image processing.
https://github.com/pablo1n7/imageform
image-processing pharo pharo-smalltalk
Last synced: 4 months ago
JSON representation
Small Lib for basic Image processing.
- Host: GitHub
- URL: https://github.com/pablo1n7/imageform
- Owner: pablo1n7
- Created: 2020-01-16T13:34:59.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-14T14:19:07.000Z (almost 5 years ago)
- Last Synced: 2024-09-25T21:41:07.545Z (4 months ago)
- Topics: image-processing, pharo, pharo-smalltalk
- Language: Smalltalk
- Homepage:
- Size: 2.78 MB
- Stars: 11
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/pablo1n7/ImageForm.svg?branch=master)](https://travis-ci.org/pablo1n7/ImageForm)
# ImageForm
Small Lib for basic Image processing. Programmed in Pharo for Pharo :)
# Install
```smalltalk
Metacello new
baseline: #ImageForm;
repository: 'github://pablo1n7/ImageForm/src';
load.
```# Basic Operations
## Open an Image.
```smalltalk
anImage := ImageForm open: '/Users/sdas/Documents/pwq7S.jpg'.
```
## Show Image.
```smalltalk
anImage show: 'Eileen Collins'.
```
![](https://raw.githubusercontent.com/pablo1n7/ImageForm/master/examples/show.jpg)## Save Image.
```smalltalk
aScaledImage save:'/Users/pablo/Documents/Pharo/pwq7S_scaled.jpg'.
aScaledImage save:'/Users/pablo/Documents/Pharo/pwq7S_scaled.png'.
```# Color Operations
## Transform to Gray Scale.
```smalltalk
aGrayImage := anImage asGrayScale
```
or```smalltalk
aGrayImage := ImageFormGrayScale open: '/Users/sdas/Documents/pwq7S.jpg'.
```
## Lighter Image.
```smalltalk
aLighterImage := anImageForm lighter:0.25.
```
## Darker Image.
```smalltalk
aDarkerImage := anImageForm darker:0.25.
```
## Negated Image.
```smalltalk
aNegatedImage := anImage negated .
```
# Image Transformations.
## Flip Image.
```smalltalk
aFlippedImage := anImage flipHorizontally.
```
```smalltalk
aFlippedImage := anImage flipVertically.
```
## Rotate Image.
```smalltalk
aRotatedImage := anImage rotateBy: 45.
```
```smalltalk
aRotatedImage := anImage rotateBy: #left centerAt: 0@0.
```
## Scale Image.
```smalltalk
aScaledImage := anImageA scaled: 100 height: 100.
```
## Crop Image.
```smalltalk
aCroppedImage := anImageForm crop: 0@0 h: 300 w: 500.
```
# Basic Arithmetics.
```smalltalk
anImageA := ImageForm open: '/Users/sdas/Documents/pwq7S.jpg'.
anImageB := ImageForm open: '/Users/sdas/Documents/pharo.png'.aSubResult := anImageB - anImageA.
```
```smalltalk
aSumResult := anImageB + anImageA.
```
# Advanced Operations
## Operations with kernels (3x3 and 5x5)```smalltalk
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 .
```
```smalltalk
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
```smalltalk
anImage := ImageForm open: '/Users/pablo/Documents/pharo/icon.png'.
aGrayImage := anImage asGrayScale.
```## Transform to Binary Image.
```smalltalk
aBinaryImage := aGrayImage asBinaryImage: 0.1.
```
## Erosion.
```smalltalk
anErosionImage := aBinaryImage erosion: ImageFormGrayScale squareKernel3x3 iterations: 6.
```
## Dilation.
```smalltalk
anDilationImage := aBinaryImage dilation: ImageFormGrayScale squareKernel3x3 iterations: 6.
```