Difference between revisions of "LazPaint"

From Lazarus wiki
Jump to navigationJump to search
(→‎Quick start: line position)
 
(91 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LazPaint}}
+
<div style="text-align: right; height: 1.5em">{{LazPaint(pg)}}</div>
 +
<div style="background: rgb(15,11,80); background: linear-gradient(90deg, rgba(15,11,80,1) 0%, rgba(55,55,157,1) 35%, rgba(34,171,103,1) 100%); border: 1px solid black; padding: 8px; border-radius:20px; text-align: center; padding-top: 1em; padding-bottom: 1em; color: white;">
 +
<div><span style="text-shadow:5px 5px 9px rgba(0,0,0,0.3); font-size: 25px">'''LazPaint'''</span></div><br/>
 +
<font size="+1">Free cross-platform image editor with raster and vector layers, written in Lazarus (Free Pascal).</font><br/>
 +
<br/>
 +
<span style="padding: 8px; border-radius:5px; border: 1px solid silver; text-transform: uppercase">[https://lazpaint.blogspot.com/ <font color="silver">Blog</font>]</span>
 +
<span style="padding: 8px; border-radius:5px; border: 1px solid silver; text-transform: uppercase">[https://lazpaint.github.io/last/ <font color="silver">Last changes</font>]</span>
 +
<span style="padding: 8px; border-radius:5px; border: 1px solid white; border-bottom: 4px solid white; text-transform: uppercase">Documentation</span>
 +
<span style="padding: 8px; border-radius:5px; border: 1px solid silver; text-transform: uppercase">[https://lazpaint.github.io/ <font color="silver">Download</font>]</span>
 +
<span style="padding: 8px; border-radius:5px; border: 1px solid silver; text-transform: uppercase">[http://lazpaint.blogspot.com/p/screenshots.html <font color="silver">Screenshots</font>]</span>
 +
<span style="padding: 8px; border-radius:5px; border: 1px solid silver; text-transform: uppercase">[https://forum.lazarus.freepascal.org/index.php/board,46.0.html <font color="silver">Forum</font>]</span>
 +
<span style="background-color: #3b5e98; padding: 8px; border-radius:5px; border: 1px solid #3b5ea0; font-weight: bold">[https://www.facebook.com/LazPaint <font color="white">f</font>]</span>
 +
</div>
  
LazPaint is an image editor, like PaintBrush or Paint.NET, written in Lazarus (Free Pascal). It uses the library [[BGRABitmap|BGRABitmap]] to draw.
+
<table><tr><td width="50%">
 +
<div style="text-align: center"><span style="background:#60d000; color:white; padding: 8px; border-radius:8px">[http://sourceforge.net/donate/index.php?group_id=404555 <font color=white>Donate</font>]</span></div>
  
The drawing takes into account the level of transparency (alpha channel), shape borders are rendered with antialiasing, and color composition includes gamma correction.
 
  
=== Download ===
+
<big>'''History'''</big>
  
Source code can be downloaded on Sourceforge, and needs to be compiled for the platform used (Win32, Win64, Linux, MacOS). MacOS version is experimental. Binaries are also available.
+
LazPaint was started to demonstrate the capabilities of the graphic library [[BGRABitmap|BGRABitmap]]. It provides advanced drawing functions in [[Lazarus]] development environment. Both provided a source of inspiration for the other and finally LazPaint became real image editor. Thanks to the help of Lazarus community, the program has been compiled on Windows, Linux and macOS.
 +
</td><td>&nbsp;</td><td>
 +
<big>'''Features'''</big>
  
http://sourceforge.net/projects/lazpaint/
+
[[LazPaint File|Files]]: read and write a variety of file formats, including layered bitmaps and 3D files.
  
svn download is here:
+
[[LazPaint Tools|Tools]]: many tools are available to draw on the layers.
  
svn co https://lazpaint.svn.sourceforge.net/svnroot/lazpaint lazpaint
+
[[LazPaint Edit|Edit/Select]]: select parts of an image with antialiasing and modify the selection as a mask.
  
=== Screenshots ===
+
[[LazPaint Windows|View]]: color window, layer stack window and toolbox window.
  
[[Image:Lazpaint curve redim.png]]
+
[[LazPaint Command line|Command line]]: call LazPaint from a console.
  
=== Interface ===
+
[[LazPaint scripts|Scripts]]: scripts are provided to do layer effects. You can as well write your own [https://www.python.org/ Python] scripts.
 +
</td></tr></table>
  
Many common actions can be done with the toolbar. Zoom can be changed with the magnifying glass (+ or -), or by clicking on the 1:1 button to show the image at its original size in pixels, or with the zoom fit button to set the zoom so that the whole image be within the window.
+
=== Quick start ===
  
It is possible to do/undo the 50 last operations. If you have a doubt on what you are drawing, undo back to the beginning, save a copy, and redo the modifications before going further.
+
<table><tr><td width="50%">
 +
<big>'''Useful keys'''</big>
  
=== Windows ===
+
* Maintaining Space key down switches temporarily in move mode
 +
* F6 key hides/shows all tool windows
 +
* Ctrl key aligns to image pixels and limits possible angles with rotation tool
 +
* Backspace key erases last point in a polygon or last letter in a text
 +
* Enter key releases the selection
  
The main window allows to draw, and there is also a color circle window and a toolbox. Use the color circle window to select a color, its luminosity and its opacity. The toolbox offers a wide range of drawings tool and selection tools.
+
Right mouse button can be used to:
 +
* Swap drawing colors temporarily
 +
* Subtract from selection (selection tool)
 +
* Define reference position (light position for shaded text and shapes, rotation center, clone tool source)
 +
* Finish a shape (polygon, curve)
 +
* Rotate a shape (clicking corners)
  
=== Selection ===
+
Left clicking in the small color preview will select the pen / background / outline color or if it is a gradient, the start / end color, to be edited with the color chooser.
 +
</td><td>&nbsp;</td><td>
 +
<big>'''Video tutorials'''</big>
  
Selection is composed with rectangles, ellipses and pen drawing. It contains levels of transparency, so that the border of an elliptic region has antialiasing. If you do a hole in your bitmap, the border will be antialiased, and if you draw a gradient inside an elliptic selection, the border will be with antialiasing.
+
Video tutorials are available on Youtube :
 +
* [http://www.youtube.com/watch?v=9G6XcQdBtDo Getting started]
 +
* [http://www.youtube.com/watch?v=UEGQk1UhJ2w Advanced drawing tools]
 +
* [http://www.youtube.com/watch?v=6zWohQYLW3g Using selection tools]
 +
* [http://www.youtube.com/watch?v=EmKzqKneJeI Text with projected shadow]
 +
* [http://www.youtube.com/watch?v=9z6WgIaUYwQ Drawing a vortex]
 +
* [http://www.youtube.com/watch?v=FFEZpl15Rb4 Export for Krita]
 +
* [http://www.youtube.com/watch?v=Hxinfs6ziFc Using layers, magic wand and perspective]
 +
* [http://www.youtube.com/watch?v=yWgo0fcdOSg Draw a fire] (''overlay'' blending mode)
 +
* [http://www.youtube.com/watch?v=69cHd5W-Zyg Draw lightnings] (''negation'' blending mode)
 +
* [http://www.youtube.com/watch?v=1rtHSPAUDnA Draw a neon with blur] (''lighten'' blending mode)
 +
* [http://www.youtube.com/watch?v=Lewg3iYkln8 Spline selection and glow effect] (''glow'' blending mode)
 +
* [https://www.youtube.com/watch?v=rsdPha36y50 Drop shadow] (example of layer effect)
 +
</td></tr></table>
  
With the left button you can add elements to the selection, and with the right button, you can remove elements from it. The selection can be released with a button on the toolbox or by hitting Enter.
+
=== Download ===
 
 
The rotation tool allows to rotate the current selection with a free angle.
 
 
 
Selection fit option reduces the selection to non transparent pixels.
 
  
=== Input file formats ===
+
<table><tr>
Images can be loaded with the toolbar or with the File menu.
+
<td bgcolor="#FFFFe0" style="border: 1px solid black; padding: 8px; text-align: center; border-radius:10px" width="30%">
 +
''Binaries can be downloaded on GitHub for Windows, Linux and macOS.''
  
* BMP : uncompressed bitmaps
 
* PNG : lossless compressed bitmaps
 
* JPG : lossy compression
 
* PDN : file with layers from Paint.NET (image is flattened while loading)
 
* GIF : user can choose a frame
 
* ICO : user can choose a size
 
  
=== Output formats ===
+
'''[https://lazpaint.github.io Download]''' '''[https://portableapps.com/apps/graphics_pictures/lazpaint-portable Portable]'''
BMP, PNG and JPG
 
  
=== Image manipulation ===
+
[http://sourceforge.net/donate/index.php?group_id=404555 Support this project]
Image can be resampled, flipped horizontally and vertically.
 
  
Smart zoom x3 : resize the image x3 and detects borders, to have a useful zoom with ancient games sprites.
+
[[LazPaint Make it portable|How to make a portable version]]
 +
</td><td>&nbsp;</td><td>
 +
'''Source code'''
  
=== Color manipulation ===
+
The source code can be downloaded on GitHub:
* Colorize : set the color of an image while preserving intensities
 
* Shift colors : cycle colors and change colorness (saturation)
 
* Intensity : make colors lighter or darker without making them white
 
* Lightness : make colors lighter or darker by making them whiter
 
* Normalize : use the whole range of each color channel and alpha channel
 
* Negative : invert colors (with gamma correction)
 
* Linear negative : invert colors (without gamma correction)
 
* Grayscale : converts colors to grayscale with gamma correction
 
  
=== Filters ===
+
LazPaint: https://github.com/bgrabitmap/lazpaint/
Filters can be applied to the whole image or to the active selection.
 
  
*Radial blur : non directional blur
+
BGRAControls: https://github.com/bgrabitmap/bgracontrols/
*Motion blur : directional blur
 
*Custom blur : blur according to a mask
 
  
*Sharpen : makes contours more accute, complementary to Smooth
+
BGRABitmap: https://github.com/bgrabitmap/bgrabitmap/
*Smooth : softens whole image, complementary to Sharpen
 
*Median : computes the median of colors around each pixel, which softens corners.
 
  
*Contour : draws contours on a white background (like a pencil drawing)
+
Dependencies:
*Emboss : draws contours with shadow
+
# LazPaint depends on [[BGRAControls]] and [[BGRABitmap]].
 +
# [[BGRAControls]] depends on [[BGRABitmap]].
  
*Sphere : spherical projection
+
You can download the source code and compile it for a specific platform. MacOS version is now fully functional.
*Cylinder : cylinder projection
+
</td></tr></table>
*Clouds : add clouds of the current pen color
 
  
=== Command line ===
+
=== Compilation of latest version ===
  
General use :
+
# Get '''Lazarus''' as a package in your distribution or download it at https://sourceforge.net/projects/lazarus/files/
lazpaint inputfile [/command1 [/command2...]] [outputfile]
+
# Open '''Lazarus''' to check it works
 +
# Download latest version of ''BGRABitmap'' at https://github.com/bgrabitmap/bgrabitmap/releases
 +
# Open the package file ''BGRABitmapPack.lpk'' in '''Lazarus'''
 +
# Download latest version of ''BGRAControls'' at https://github.com/bgrabitmap/bgracontrols/releases
 +
# Open the package file ''bgracontrols.lpk'' in '''Lazarus'''
 +
# Download ''LazPaint'' at https://github.com/bgrabitmap/lazpaint/releases
 +
# Open the package file ''lazpaintcontrols.lpk'' in '''Lazarus'''
 +
# Open the project file ''lazpaint.lpi'' or ''lazpaint.lpr'' in '''Lazarus''' (choose to Open project if prompted)
 +
# Click the green triangle "Run" and check if the program is working
 +
# Close ''LazPaint'' and close '''Lazarus''' and go in the ''release'' folder of the project
  
On Linux, command prefix is '-'.
+
The essential files are: the executable file, the readme file, the ''models'', ''i18n'' and ''scripts'' folders.
on Windows, command prefix can be '-' or '/'.
 
  
==== Line without command ====
+
Additional files and instructions are in ''release'' folder for each platform:
 +
* '''''windows''''': run the batch file ''stage.bat'' to generate a ''lazpaint32'' and ''lazpaint64'' folders that contains everything (it adds particular support for WebP and RAW images by adding ''dcraw.exe'' and ''libwebp.dll'').
 +
* '''''macOS''''': go in the folder with the terminal and call ''./makedmg.sh'' to generate the bundle.
 +
* '''''debian''''': go in the folder with the terminal and call ''./makedeb.sh'' to generate the DEB package and the TAR.GZ file.
  
You can omit commands to convert an image to another file format. For example :
+
Note: when debugging on Windows, you may want to have support for WebP and RAW images. You can do that by copying the ''dcraw.exe'' and ''libwebp.dll'' files next to the compiled files (for example ''debug\i386-win32'' for 32-bit version).
lazpaint image.pdn image.png
 
will flatten and save a Paint.NET image into a PNG.
 
  
==== Line without output file ====
+
=== Screenshots ===
  
If you do not specify an output file, the application is opened with the resulting image. For example :
+
==== LazPaint on Linux (and dark theme) ====
lazpaint image.png /RotateCW
+
[[Image:Lazpaint version 7.png]]
will open the image with a 90° rotation.
 
  
==== Line without input file ====
+
==== LazPaint on Windows ====
 +
[[Image:Lazpaint curve redim.png]]
  
You can also create an image out of nothing. For example :
+
==== LazPaint on Puppy Linux ====
lazpaint /New(800,600) /Gradient(255,255,255,255,0,0,0,255,Linear,0,0,800,600) blackwhite.png
+
[[Image:lazpaint6_puppy.png]]
will create an image with a black and white gradient and save it into blackwhite.png.
 
  
==== General commands ====
+
=== Interface ===
  
Here is the list of supported commands :
+
Many common actions can be done with the toolbar. Zoom can be changed with the magnifying glass (+ or -), or by clicking on the 1:1 button to show the image at its original size in pixels, or with the zoom fit button to set the zoom so that the whole image be within the window.
* /HorizontalFlip : flips image horizontally
 
* /VerticalFlip : flips image vertically
 
* /SwapRedBlue : swaps red and blue channels
 
* /RotateCW : rotates image clockwise
 
* /RotateCCW : rotates image counterclockwise
 
* /Resample(Width,Height: Integer) : resample image to Width x Height
 
* /Opacity(Value: Byte) : applies a global factor to opacity
 
* /Gradient(red1,green1,blue1,alpha1,red2,green2,blue2,alpha2: Byte; type; x1,y1,x2,y2: Single) : draws a gradient. Type can be Linear, Reflected, Diamond or Radial.
 
* /New(Width,Height) : creates a new empty image of Width x Height
 
  
For example :
+
It is possible to undo/redo the 200 last operations. If you have a doubt on what you are drawing, undo back to the beginning, save a copy, and redo the modifications before going further.
lazpaint bigimage.bmp /Resample(320,200) smallimage.png
 
will save a small copy of bigimage.bmp into smallimage.png
 
  
==== Filter commands ====
+
=== Image manipulation ===
 +
An image can be resampled, flipped horizontally and vertically.
  
You can apply filters with default values. Here is the list of filter commands :
+
Smart zoom x3 : resize the image x3 and detects borders; this provides a useful zoom with ancient games sprites.
  
'''Blur filters :''' BlurPrecise, BlurRadial, BlurFast, BlurCorona, BlurDisk, BlurMotion, BlurCustom
+
=== Color manipulation ===
 +
* Colorize : set the color of an image while preserving intensities
 +
* Shift colors : cycle colors and change colorness (saturation)
 +
* Intensity : make colors lighter or darker without making them white
 +
* Lightness : make colors lighter or darker by making them whiter
 +
* Normalize : use the whole range of each color channel and alpha channel
 +
* Negative : invert colors (with gamma correction)
 +
* Linear negative : invert colors (without gamma correction)
 +
* Grayscale : converts colors to grayscale with gamma correction
  
'''Pixel filters :''' Sharpen, Smooth, Median, Emboss, Contour, Grayscale, Negative, LinearNegative, Normalize, SmartZoom3
+
=== Filters ===
 +
Filters can be applied to the whole image or to the active selection.
  
'''Deformation filters :''' Sphere, Twirl, Cylinder, Plane
+
* Radial blur : non directional blur
 +
* Motion blur : directional blur
 +
* Custom blur : blur according to a mask
  
'''Rendering filters :''' PerlinNoise, CyclicPerlinNoise, Clouds, CustomWater, Water, Wood, WoodVertical, Plastik, MetalFloor, Camouflage, SnowPrint, Stone, RoundStone, Marble
+
* Sharpen : makes contours more accute, complementary to Smooth
 +
* Smooth : softens whole image, complementary to Sharpen
 +
* Median : computes the median of colors around each pixel, which softens corners
  
For example :
+
* Contour : draws contours on a white background (like a pencil drawing)
lazpaint photo.jpg /Contour /Emboss /Normalize
+
* Emboss : draws contours with shadow
will transform the image into a carved stone.
 
  
[[Category:Example programs]]
+
* Sphere : spherical projection
[[Category:Graphics]]
+
* Cylinder : cylinder projection
 +
* Clouds : add clouds of the current pen color

Latest revision as of 20:13, 30 January 2024

LazPaint

Free cross-platform image editor with raster and vector layers, written in Lazarus (Free Pascal).

Blog Last changes Documentation Download Screenshots Forum f


History

LazPaint was started to demonstrate the capabilities of the graphic library BGRABitmap. It provides advanced drawing functions in Lazarus development environment. Both provided a source of inspiration for the other and finally LazPaint became real image editor. Thanks to the help of Lazarus community, the program has been compiled on Windows, Linux and macOS.

 

Features

Files: read and write a variety of file formats, including layered bitmaps and 3D files.

Tools: many tools are available to draw on the layers.

Edit/Select: select parts of an image with antialiasing and modify the selection as a mask.

View: color window, layer stack window and toolbox window.

Command line: call LazPaint from a console.

Scripts: scripts are provided to do layer effects. You can as well write your own Python scripts.

Quick start

Useful keys

  • Maintaining Space key down switches temporarily in move mode
  • F6 key hides/shows all tool windows
  • Ctrl key aligns to image pixels and limits possible angles with rotation tool
  • Backspace key erases last point in a polygon or last letter in a text
  • Enter key releases the selection

Right mouse button can be used to:

  • Swap drawing colors temporarily
  • Subtract from selection (selection tool)
  • Define reference position (light position for shaded text and shapes, rotation center, clone tool source)
  • Finish a shape (polygon, curve)
  • Rotate a shape (clicking corners)

Left clicking in the small color preview will select the pen / background / outline color or if it is a gradient, the start / end color, to be edited with the color chooser.

 

Video tutorials

Video tutorials are available on Youtube :

Download

Binaries can be downloaded on GitHub for Windows, Linux and macOS.


Download Portable

Support this project

How to make a portable version

 

Source code

The source code can be downloaded on GitHub:

LazPaint: https://github.com/bgrabitmap/lazpaint/

BGRAControls: https://github.com/bgrabitmap/bgracontrols/

BGRABitmap: https://github.com/bgrabitmap/bgrabitmap/

Dependencies:

  1. LazPaint depends on BGRAControls and BGRABitmap.
  2. BGRAControls depends on BGRABitmap.

You can download the source code and compile it for a specific platform. MacOS version is now fully functional.

Compilation of latest version

  1. Get Lazarus as a package in your distribution or download it at https://sourceforge.net/projects/lazarus/files/
  2. Open Lazarus to check it works
  3. Download latest version of BGRABitmap at https://github.com/bgrabitmap/bgrabitmap/releases
  4. Open the package file BGRABitmapPack.lpk in Lazarus
  5. Download latest version of BGRAControls at https://github.com/bgrabitmap/bgracontrols/releases
  6. Open the package file bgracontrols.lpk in Lazarus
  7. Download LazPaint at https://github.com/bgrabitmap/lazpaint/releases
  8. Open the package file lazpaintcontrols.lpk in Lazarus
  9. Open the project file lazpaint.lpi or lazpaint.lpr in Lazarus (choose to Open project if prompted)
  10. Click the green triangle "Run" and check if the program is working
  11. Close LazPaint and close Lazarus and go in the release folder of the project

The essential files are: the executable file, the readme file, the models, i18n and scripts folders.

Additional files and instructions are in release folder for each platform:

  • windows: run the batch file stage.bat to generate a lazpaint32 and lazpaint64 folders that contains everything (it adds particular support for WebP and RAW images by adding dcraw.exe and libwebp.dll).
  • macOS: go in the folder with the terminal and call ./makedmg.sh to generate the bundle.
  • debian: go in the folder with the terminal and call ./makedeb.sh to generate the DEB package and the TAR.GZ file.

Note: when debugging on Windows, you may want to have support for WebP and RAW images. You can do that by copying the dcraw.exe and libwebp.dll files next to the compiled files (for example debug\i386-win32 for 32-bit version).

Screenshots

LazPaint on Linux (and dark theme)

Lazpaint version 7.png

LazPaint on Windows

Lazpaint curve redim.png

LazPaint on Puppy Linux

lazpaint6 puppy.png

Interface

Many common actions can be done with the toolbar. Zoom can be changed with the magnifying glass (+ or -), or by clicking on the 1:1 button to show the image at its original size in pixels, or with the zoom fit button to set the zoom so that the whole image be within the window.

It is possible to undo/redo the 200 last operations. If you have a doubt on what you are drawing, undo back to the beginning, save a copy, and redo the modifications before going further.

Image manipulation

An image can be resampled, flipped horizontally and vertically.

Smart zoom x3 : resize the image x3 and detects borders; this provides a useful zoom with ancient games sprites.

Color manipulation

  • Colorize : set the color of an image while preserving intensities
  • Shift colors : cycle colors and change colorness (saturation)
  • Intensity : make colors lighter or darker without making them white
  • Lightness : make colors lighter or darker by making them whiter
  • Normalize : use the whole range of each color channel and alpha channel
  • Negative : invert colors (with gamma correction)
  • Linear negative : invert colors (without gamma correction)
  • Grayscale : converts colors to grayscale with gamma correction

Filters

Filters can be applied to the whole image or to the active selection.

  • Radial blur : non directional blur
  • Motion blur : directional blur
  • Custom blur : blur according to a mask
  • Sharpen : makes contours more accute, complementary to Smooth
  • Smooth : softens whole image, complementary to Sharpen
  • Median : computes the median of colors around each pixel, which softens corners
  • Contour : draws contours on a white background (like a pencil drawing)
  • Emboss : draws contours with shadow
  • Sphere : spherical projection
  • Cylinder : cylinder projection
  • Clouds : add clouds of the current pen color