Giter Club home page Giter Club logo

bgrabitmap / lazpaint Goto Github PK

View Code? Open in Web Editor NEW
370.0 21.0 54.0 74.11 MB

🎨 Cross-platform image editor with raster and vector layers similar to Paint.Net written in Lazarus (Free Pascal)

Home Page: https://lazpaint.github.io/

License: GNU General Public License v3.0

Pascal 85.80% Inno Setup 0.68% Shell 0.25% C 9.59% Batchfile 0.16% Python 2.86% Makefile 0.24% Roff 0.05% HTML 0.29% CSS 0.07%
bgrabitmap lazpaint lazarus paint open-source pascal vector-graphics drawing

lazpaint's Introduction

LazPaint

Free cross-platform image editor, like PaintBrush or Paint.Net, written in Lazarus (Free Pascal). Uses BGRABitmap library.

You can support the development by donating. That will allow the developper to buy carrots and beans for sustenance.

Download

Download LazPaint for Windows, Mac and Linux. The application is also available in some Linux repositories.

This application can be made portable.

Here are compilation instructions if you would like to debug or make a modified version.

Official Sites

LazPaint Wiki

LazPaint Forums

LazPaint on Facebook

LazPaint on YouTUBE

Screenshots

LazPaint Linux dark theme LazPaint Windows LazPaint Puppy Linux

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, MacOS X, FreeBSD and Raspberry Pi.

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.

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 light position (shaded text, shaded shapes)
  • Finish a shape (polygon, curve)

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.

Dark theme is supported.

Image manipulation

An image can be resampled, flipped horizontally and vertically, canvas size can be changed

  • Remove transparency : fill the transparent pixels of the image
  • Flatten : reduce a layered image to one single layer
  • Smart zoom x3 : resize the image x3 and detects borders; this provides a useful zoom with ancient games sprites.

Color manipulation

  • Curves : adjustment of curves for RGB and HSL channels
  • Posterize : reduce the number of colors by lightness or independently on each color channel
  • 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 (box, gaussian, corona...)
  • 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
  • Noise : add random pixel noise
  • Median : computes the median of colors around each pixel, which softens corners
  • ClearType : mimics the effect of TrueType font rendering
  • Apply function : applies any given function to any channel (RGB, HSL, Lab)
  • Contour : draws contours on a white background (like a pencil drawing)
  • Emboss : draws contours with shadow
  • Shaded map : draw Phong highlights and shadows using a channel of the image as altitude
  • Sphere : spherical projection
  • Twirl : Distorts the image as a vortex
  • Wave displacement : Distorts as if reflected on waves
  • Cylinder : cylinder projection

Render

  • Perlin noise : random image that can be used to make Nature-like randomness
  • Cyclic Perlin noise : same but with cyclic behavior
  • Water, snow print, wood, metal, stone, marble... : generate random texture
  • Clouds : add clouds of the current pen color
  • Rain : add rain falling with custom wind

Layer effect (via scripts)

  • Color overlay : replace the color
  • Drop shadow : add a shadow layer
  • Inner light, inner shadow : add lighting layer depending on the border (according to transparency)
  • Stroke : add a layer to draw a stroke around the shape (according to transparency)

lazpaint's People

Contributors

chronoscz avatar circular17 avatar lainz avatar lulu04 avatar omegaxhunter avatar ser82-png avatar suve avatar yambam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lazpaint's Issues

BGRASVGType bug.

Lazarus Win32.

If you have svg file with Style Attribute like this:
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.73382717px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"

You got always black, full opaque elements because of

  1. When you call for example:
    val(AttributeOrStyle['fill-opacity'], result, errPos);

  2. In AttributeOrStyle['fill-opacity'] you got '1.00;' (with semicolon), so, you got non zero error code and default value as the consequence.

Error in
procedure TSVGElement.LocateStyleDeclaration(AText: string; AProperty: string; out AStartPos,
AColonPos, AValueLength: integer);

I think AValueLength has wrong value.

Thank you for you lib!

Text style in toolbar

I checked your software. It is small and I like it. But there are two important improvements I suggest.

  1. When we play with text we should see the font style we are working with. Not by clicking a button.
  2. The text direction button as in Microsoft Word is also important to work with complext fonts.

lazarus 1.8.4 +win10+64bit,build failed

env: lazarus 1.8.4 +win10+64bit

there are lots of error:

  1. Error: Found declaration: SysToUTF8 , SysToUTF16,FileExistUTF8

after add the uses : LAZUtils, LazUTF8,LazFileUtils, to the error units, it seems ok,

  1. the math round() function in uadjustcurves.pas confict with the types.pp
    Error: Found declaration: Round:;--

so, I changed the round() to ceil(), it finally worked.

  1. LCLGetLanguageIDs()not found
    utranslation.pas(79,3) Error: Identifier not found "LCLGetLanguageIDs"

so I commented(disabled) it with //LCLGetLanguageIDs()

Finally, it worked.

HiDPI on Debian

Terrific software! I would like to suggest minor modifications to support high DPI on Debian systems.

On Debian, the function
ScreenInfo.PixelsPerInchX
always returns 96, regardless of how the user has set the application scaling. The code below can detect the GUI scaling for Debian. Perhaps this could run just once during the initialization of uscaledpi.pas, so Linux systems could use this value if it is not 1.0. It would also be great if we could provide a unified solution on the excellent High DPI - Lazarus Wiki

function getFontScale: single; var AProcess: TProcess; Exe: String; AStringList: TStringList; begin result := 1.0; Exe := FindDefaultExecutablePath('gsettings'); if length(Exe) < 1 then exit; if not FileExists(Exe) then exit; AProcess := TProcess.Create(nil); AProcess.Executable:=Exe; AProcess.Parameters.Add('get'); AProcess.Parameters.Add('org.gnome.desktop.interface'); AProcess.Parameters.Add('text-scaling-factor'); AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes]; AProcess.Execute; if (AProcess.ExitCode = 0) then begin AStringList := TStringList.Create; AStringList.LoadFromStream(AProcess.Output); if AStringList.Count > 0 then result := strtofloatdef(AStringList.Strings[0], 1.0); AStringList.Free; end; AProcess.Free; end; {$ELSE} function getFontScale: single; begin result := 1.0; end; {$ENDIF}

layer effects

  • drop shadow
  • stroke around
  • fast blur (box blur?)
  • color/gradient overlay

Index out of bounds

LazPaint 7.0.5 is unable to duplicate a layer. When I press the appropriate button the "Index out of bounds" message pops up.

License

Is there a license? Could you please add a license? Or this is not an open source app?

linux64

In releases there is a linux32 build - any possibility of a linux64 one?

Updating BgraUtf8.pas

I have updated BgraUtf8.pas to clear the deprecated messages dealing with methods that make use of FileUtil.pas and LCLProc.pp. The Lazarus 1.5/FPC 3.0+ version have added significantly to the use of UNICODE, UTF8, UTF16 support thoughout the units. The result is that the existing file BgraUtf8.pas creates warnings concerning deprecated methods. My effort has been to make changes to the preferred methods found in LazUTF8 and LazFileUtils.

Alpha mask for layer

An alpha mask feature where you can apply one layer as a mask to another layer would be greatly appreciated -- that and more filters in line with what Paint.NET has and this becomes the sanest, most user friendly image editor available on Linux.

miss lazpaint.zh-CN.po

there is have lclstrconsts.zh_CN.po but not lazpaint.zh-CN.po
can't use zh-cn language
need help

LazPaint doesnt have proper palette edition

It converts to "true color" and then save as "best" 256 color palette.

Here an same image edited and saved with four graphic editors (Paint, Paint Shop Pro 4, PictBear and Lazpaint) to check the difference.


edit: sorry, I will try explain better the problem.

I'm noticed are several image editor saving wrong colors indexes. And only a few do it properly.
Unfortunately LazPaint is one making this wrong.

The number is indicating color index
I will say the color index in this order:
top right square, bottom right square, top left square, bottom left square, center (pink)

This is the original image
https://s6.postimg.org/4cjwgv6up/original_index.png
The color index is: 1, 2, 3, 4, 0 - as indicates the image, of course :P

Now, we will modify and save the image in these programs:
LazPaint, RealWorld Paint, PictBear, Paint Shop Pro 4.

The image edited with LazPaint:
https://s6.postimg.org/slefetwmp/image_Laz_Paint.png
The color index now is: 4, 1, 3, 0, 2 - wrong index

The image edited with RWPaint:
https://s6.postimg.org/6v5lhjskx/image_RWPaint.png
The color index now is: 1, 4, 2, 3, 0 - wrong index

The image edited with PictBear:
https://s6.postimg.org/v06az9cvl/image_Pict_Bear.png
The color index now is: 1, 2, 3, 4, 0 - correct index

The image edited with Paint Shop Pro 4:
https://s6.postimg.org/pq1c7ysmp/image_Paint_Shot_PPro4.png
The color index now is: 1, 2, 3, 4, 0 - correct index

Note: You can view the color index with Paint Shop Pro 4 using the color selector tool
example: https://s6.postimg.org/nb9gnjcdt/psp4_colors.gif

From forum: https://forum.lazarus.freepascal.org/index.php/topic,38074.0.html

LazPaint cannot save much colored pic as BMP 256 colors

After some editing I have too much colors in pic (i didnt want it),
and now I cannot save pic as BMP 16 color or 256 color. It allows only 24bit.
Pls, ALWAYS enable them, so I can save pic with downsample to 256 colors.

Compiling in trunk

umultiimage.pas(74,30) Error: Only static methods and static variables can be referenced through an object type

bring lazpaint to debian

Move closer to make LazPaint as official debian package sometime in the future. So then installation would be as simple as "apt install lazpaint". Also upgrades would be automatic.

layer groups

folders that can contain layers like embedded LZP file

TTextStyle.RightToLeft in TextRec not working

TBGRABitmap.TextRec result (the forth line of the image attached) Should be as the TCanvas.TextRec result (the third line of the image attached).

image

and here is the code I used:

procedure TForm1.FormPaint(Sender: TObject);
var
  image: TBGRABitmap;
  TS: TTextStyle;
begin
  image := TBGRABitmap.Create(ClientWidth, ClientHeight);
  image.FontName := Font.Name;
  image.FontHeight := Font.Height;
  TS.Opaque := False;

  TS.RightToLeft := False;
  Canvas.TextRect(Rect(5, 5, 250, 20), 5, 5, 'TCanvas With RightToLeft := False', TS);
  Canvas.TextRect(Rect(250, 5, 500, 20), 250, 5, 'أب+', TS);

  image.TextRect(Rect(5, 20, 250, 35), 5, 20, 'TBGRABitmap With RightToLeft := False', TS, BGRA(0,0,0));
  image.TextRect(Rect(250, 20, 500, 35), 250, 20, 'أب+', TS, BGRA(0,0,0));
  image.Draw(Canvas, 0, 0, False);

  TS.RightToLeft := True;
  Canvas.TextRect(Rect(5, 35, 250, 50), 5, 35, 'TCanvas With RightToLeft := True', TS);
  Canvas.TextRect(Rect(250, 35, 500, 50), 250, 35, 'أب+', TS);

  image.TextRect(Rect(5, 50, 250, 65), 5, 50, 'TBGRABitmap With RightToLeft := True', TS, BGRA(0,0,0));
  image.TextRect(Rect(250, 50, 500, 65), 250, 50, 'أب+', TS, BGRA(0,0,0));
  image.Draw(Canvas, 0, 0, False);

  image.Free;
end;

Small translation

If I translated all correctly, is still missing the new menu entry File > Remember save format. That's not in the po file.

Linear gradients of SVG

[BGRABitmap issue]
From the forum
https://forum.lazarus.freepascal.org/index.php/topic,12037.msg335467.html#msg335467

Please fix an issue with the linear gradients of svg, which seems to be not painted, but it's only a size issue.

The issue is in "TSVGElementWithGradient.CreateCanvasLinearGradient(...)" and this code...

    p1.x:= Units.ConvertWidth(g.x1,AUnit,w).value;
    p1.y:= Units.ConvertHeight(g.y1,AUnit,h).value;
    p2.x:= Units.ConvertWidth(g.x1,AUnit,w).value;
    p2.y:= Units.ConvertHeight(g.y1,AUnit,h).value;

...should be...

    p1.x:= Units.ConvertWidth(g.x1,AUnit,w).value;
    p1.y:= Units.ConvertHeight(g.y1,AUnit,h).value;
    p2.x:= Units.ConvertWidth(g.x2,AUnit,w).value;  <- change here
    p2.y:= Units.ConvertHeight(g.y2,AUnit,h).value;  <- change here

After these changes the linear gradients will be painted as expected.

MultiSelect is disabled if LazPaint is opened with a commandline image

I was wondering why sometimes I cannot select multiple images from a directory and at other times I can. I think I found the cause. If I open LazPaint with no image, I can select multiple images in the file selection dialog, however, if I launched LazPaint with a commandline image, I can only select a single image in the file selection dialog.

customize toolbars

I work very often visually with mouse and toolbars.
Therefore I would appreciate to have customized toolbar(s) left and top which offer e.g. icons for crop to selection, undo, contrast, rotate.
Pleae add this in the next release
Thank you
Peter

Compiling on macOS

Hi, I finally have the Mac. BGRABitmap, BGRAControls, MaterialDesign, all compiled fine.

When I try to compile LazPaint the first problem I found is this:
if (Clipboard.Formats[i] = PredefinedClipboardFormat(pcfDelphiBitmap)) or

In the clipboard unit.

Maybe you want to install Lazarus trunk on Linux to test as well, is a change on the LCLType unit.

I'm using fpcupdeluxe to install, nothing else works on Mac, but Lazarus trunk and FPC trunk 64 bit.

EIntOverflow with 32 bit binary

lazpaint

        {$hints off}
        ec.red := (ec.red*($FFFF-gray)+level*gray) shr 16;
        ec.green := (ec.green*($FFFF-gray)+level*gray) shr 16;
        ec.blue := (ec.blue*($FFFF-gray)+level*gray) shr 16;
        {$hints on} 

Hi, this happens when I run LazPaint 'Debug' 32 bit, compiled with Lazarus Trunk and FPC Trunk. When compiled in 'Debug' 64 bit it works fine.

I don't know if is still a good idea to mantain 32 bit Windows, since only really old PC still uses 32 bit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.