Recent

Author Topic: Headless graphics?  (Read 5019 times)

Trenatos

  • Hero Member
  • *****
  • Posts: 535
    • MarcusFernstrom.com
Headless graphics?
« on: September 20, 2017, 09:27:43 pm »
I got a request to create a program that can run on a headless linux server and generate images.

I'm not used to creating images, does anyone have suggestions of libraries I should look at that works on a headless setup?

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: Headless graphics?
« Reply #1 on: September 20, 2017, 10:39:55 pm »
From my personal experience, at least ImageMagick (PascalMagick) was able to do so.
Basically you don't need running X to generate bitmaps.
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
Re: Headless graphics?
« Reply #2 on: September 20, 2017, 10:42:48 pm »
FPC can do that out of the box with TImage. That is in itself independent of widget sets, so will simply work on a headless machine.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Headless graphics?
« Reply #3 on: September 20, 2017, 10:52:07 pm »
Rather than TImage, which is a visual component, I'd suggest using its inner part: TPicture. TImage is actually depends on widgetset implementation, as it has rendering capability, but TPicture does not, it's purely an abstract graphic container over known formats.

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
Re: Headless graphics?
« Reply #4 on: September 20, 2017, 11:06:27 pm »
Rather than TImage, which is a visual component, I'd suggest using its inner part: TPicture. TImage is actually depends on widgetset implementation, as it has rendering capability, but TPicture does not, it's purely an abstract graphic container over known formats.
Correct, I mean TfpCustomimage/TFpMemoryImage... in fcl-image. Which is non-visual.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: Headless graphics?
« Reply #5 on: September 20, 2017, 11:26:01 pm »
There is BGRABitmap for NoGui. Try if works, if not you will see.  ::)

Trenatos

  • Hero Member
  • *****
  • Posts: 535
    • MarcusFernstrom.com
Re: Headless graphics?
« Reply #6 on: September 21, 2017, 12:15:04 am »
I'm having issues with anything that uses lfreetype.  Guessing it has to do with 64bit version of that vs 32bit version of Lazarus on Mac.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Headless graphics?
« Reply #7 on: September 21, 2017, 01:20:29 am »
I'm having issues with anything that uses lfreetype.  Guessing it has to do with 64bit version of that vs 32bit version of Lazarus on Mac.

Probably. If you're still running an older 32-bit Mac with Carbon, you'll likely need to build FreeType yourself as I'm not aware of anywhere you'd be able to get a prebuilt 32-bit "dylib".

Trenatos

  • Hero Member
  • *****
  • Posts: 535
    • MarcusFernstrom.com
Re: Headless graphics?
« Reply #8 on: September 21, 2017, 04:52:35 am »
Actually I'm running El Capitan on a not-so-old Macbook, but I can't find a x64 version of FPC/Lazarus, I can only build 32bit applications so it fails with the 64bit freetype.

I'll see if I can build a copy myself.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Headless graphics?
« Reply #9 on: September 21, 2017, 05:20:57 am »
Actually I'm running El Capitan on a not-so-old Macbook, but I can't find a x64 version of FPC/Lazarus, I can only build 32bit applications so it fails with the 64bit freetype.

I'll see if I can build a copy myself.

Ah, sorry. I always forget that native x64 FPC/Lazarus (i.e. no crosscompilers or anything like that) is not something that's available as a part of any standard download, as I always build it myself. Although, I think FPCUpDeluxe might have a native x64 option? Or does that pull in the crosscompilers as well? CodeTyphon definitely does but that's presumably not the direction you want to take...

Either way, the officially stated reasons for not having a properly supported "mainstream" x64 binary release are shaky at best IMO... and it's certainly true that there are exactly zero benefits, ever, to running 32-bit Lazarus or FPC on a native x64 operating system. (In most cases the 32-bit versions end up being non-trivially slower, in fact...)
« Last Edit: September 23, 2017, 01:55:05 am by Akira1364 »

Trenatos

  • Hero Member
  • *****
  • Posts: 535
    • MarcusFernstrom.com
Re: Headless graphics?
« Reply #10 on: September 21, 2017, 03:44:24 pm »
FPCUpDeluxe does have a 64bit option, but it doesn't work for Mac.

I can't remember his name right now, but the guy who runs it said it's on his todo list, so at some point we'll get support for that.

Apart from that, I love fpcupdeluxe, I have crosscompilers for linux and windows because of it and it works really nicely, with 64bit compilers for those platforms.

I don't know how to build 64bit FPC with crosscompiler support myself, and I need cross compilation more than I need 64bit at the moment   :/

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Headless graphics?
« Reply #11 on: September 23, 2017, 06:53:13 pm »
I'm not used to creating images, does anyone have suggestions of libraries I should look at that works on a headless setup?
Take a look at AggPas - included in fpGUI Toolkit's code repository. AggPas is 100% implemented in Object Pascal, doesn't require a GUI (can be used independently of fpGUI) and does sub-pixel anti-aliased drawing. It is a pascal port of the highly regarded C++ AGG library.

  https://github.com/graemeg/fpGUI/tree/develop/src/corelib/render/software

A sample image generated by AggPas - everything you see in the screenshot is generated in code using AggPas.

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Trenatos

  • Hero Member
  • *****
  • Posts: 535
    • MarcusFernstrom.com
Re: Headless graphics?
« Reply #12 on: September 23, 2017, 09:36:55 pm »
Fantastic, thanks Graeme I'll give that a shot   :)

 

TinyPortal © 2005-2018