LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2021, 08:36 PM   #16
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,375

Original Poster
Blog Entries: 30

Rep: Reputation: 163Reputation: 163

Quote:
Originally Posted by John VV View Post
not in python but in c++
there is Gmic

a 100 % code generated image
i have generated images using C. i have only put them in web pages. maybe i want to do that in Python3, now. i will need to know how those libraries expect the pixels. presumably type bytes would be used. but they may use a gamma byte. they may use 3 bytes or 4 bytes per pixel. they may support HDR in 16 bit modes. what i am looking for is a program which addressed those issues from a Python3 perspective during its design.

Gmic looks like an app, itself (for image manipulation). libraries it is using are likely designed with C++ bindings.
 
Old 10-18-2021, 08:52 PM   #17
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,375

Original Poster
Blog Entries: 30

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by dugan View Post
So google for OpenCV Python examples? LOL? I could do that for you, but why?
i got documentation showing how to output Python source code embeds of image in a rather inefficient form (list of list of ints).
 
Old 10-19-2021, 09:10 AM   #18
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 1,782

Rep: Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456Reputation: 1456
Quote:
Originally Posted by Skaperen View Post
an example that does is one that loads an image file and changes some pixels before displaying in the window it is working. this could be the image of a house with a backgroundd name of the seller or real estate agent added.
Ok, so you don't care about manipulating pixels, you want to do an image overlay.

OpenCV does this. It can overlay one image on another, or text on an image, or it can draw lines/circles/etc.

It can use whatever parameters you want for colour, transparency, font, size, etc.

It is super easy to find working examples of this being done in Python.

OpenCV will do precisely what you need, and it will do it more efficiently than any pixel manipulation logic you might write yourself.

 
Old 10-19-2021, 09:15 PM   #19
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,375

Original Poster
Blog Entries: 30

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by EdGr View Post
Skaperen - check out Cairo, a powerful 2D drawing library. It even has Python bindings.

Your program should call Cairo's drawing primitives whenever possible. If your program must draw pixels, Cairo provides an image surface to draw on. Be aware that using Cairo's drawing primitives will be faster than drawing pixels yourself.
Ed
Cairo looks like it can have uses for me. it is unclear if it helps my current need. this current need is to gather knowledge about librar(y,ies) to use. having enough knowledge to use to make a decision is the point of success. the first program driving this will need to draw about 269361 pixels. i do not want to do this with 269361 library calls, though, even (and especially) if i was doing this in C. part of it will be in C but that part is in another process that could be in another machine or cloud instance, communicating by network.
 
Old 10-20-2021, 06:40 AM   #20
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 726

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Quote:
Originally Posted by Skaperen View Post
Cairo looks like it can have uses for me. it is unclear if it helps my current need. this current need is to gather knowledge about librar(y,ies) to use. having enough knowledge to use to make a decision is the point of success. the first program driving this will need to draw about 269361 pixels. i do not want to do this with 269361 library calls, though, even (and especially) if i was doing this in C. part of it will be in C but that part is in another process that could be in another machine or cloud instance, communicating by network.
The application program can mix calling Cairo's drawing primitives with drawing pixels itself. See example 1.

You will need to figure out how to draw pixels.
Ed
 
Old 10-20-2021, 12:09 PM   #21
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 10,188

Rep: Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752Reputation: 4752
Quote:
Originally Posted by Skaperen View Post
an example that does is one that loads an image file and changes some pixels before displaying in the window it is working. this could be the image of a house with a backgroundd name of the seller or real estate agent added.
You realize that ImageMagick can do this, yes?

Quote:
Originally Posted by Skaperen View Post
i got documentation showing how to output Python source code embeds of image in a rather inefficient form (list of list of ints).
That's not "inefficient'. That's literally what it's like to work with "raw" pixels.

Quote:
Originally Posted by Skaperen View Post
the first program driving this will need to draw about 269361 pixels. i do not want to do this with 269361 library calls
You want to set one pixel at a time, but you don't want to set one pixel at a time? Is that what you're saying? (Hint: yes).

Do you realize that nothing you're saying makes sense?

Attach a sample output image and, if applicable, a sample input image. Then we'll talk.

Last edited by dugan; 10-20-2021 at 07:42 PM.
 
1 members found this post helpful.
Old 10-21-2021, 05:50 PM   #22
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,375

Original Poster
Blog Entries: 30

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by EdGr View Post
You will need to figure out how to draw pixels.
Ed
exactly. i will need to understand how they are making the pixels available. if in a format used by the C code, it may be hard in Python but i can generally figure this out. maybe it can even be an example how to call my own C code in the same process.
 
Old 10-21-2021, 06:17 PM   #23
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,375

Original Poster
Blog Entries: 30

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by dugan View Post
You realize that ImageMagick can do this, yes?
i thought ImageMagick is a set of programs. is it also a Python library?



Quote:
Originally Posted by dugan View Post
That's not "inefficient'. That's literally what it's like to work with "raw" pixels.
i would avoid the ints except in buffers where i am doing more complex calculations. the ideal way to me would be a bytearray with either 3 or 4 bytes per pixel (1 for grayscale. it depends on what my code is interfacing with. i never used lists of lists of ints in C.



Quote:
Originally Posted by dugan View Post
You want to set one pixel at a time, but you don't want to set one pixel at a time? Is that what you're saying? (Hint: yes).
that depends on the order. if i'm populating the whole image that's one thing. if i'm drawing an object at one spot that's another. then that are shadows and transparency, effects from glass lenses, and such. this first project will be drawing colorized Julia or Mandelbrot sets in a grid field (some extra pixels reserved for the grid). when the user clicks on one grid square, it will be expanded to the whole image, hopefully via some call to have the GPU speed that up.

Quote:
Originally Posted by dugan View Post
Do you realize that nothing you're saying makes sense?
is it that extreme? maybe i'm still thinking in C when planning for Python.

Quote:
Originally Posted by dugan View Post
Attach a sample output image and, if applicable, a sample input image. Then we'll talk.
no samples exist, yet. this is still depending much on what a chosen library can do. what my C code originally did was convert it's image to a PNG fill and let the bash script that ran it next run some program to show that file. i might still have some those files but there is no UI in it.

Last edited by Skaperen; 10-21-2021 at 06:18 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to generate a animated GIF or movie out of images on Linux LXer Syndicated Linux News 0 11-19-2015 08:41 PM
Cookies in PHP where resized images generate on the fly each time source is read? ziphem Linux - General 0 02-15-2014 04:44 AM
How to Generate MD5SUMS.sign files while uploading ISO images kushalkoolwal Linux - Security 2 07-06-2008 12:30 PM
C++/SDL: Images moving too slowly. Images loaded once, etc. Why? RHLinuxGUY Programming 2 05-26-2007 06:11 PM
Convert cd images to dvd images rcsuk Debian 2 07-11-2005 11:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration