Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 296319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:32:17+00:00 2026-05-12T06:32:17+00:00

For a home project I need to plot (x,y) coordinates onto a 400×400 black

  • 0

For a home project I need to plot (x,y) coordinates onto a 400×400 black and white-bitmap.

What perl module would you recoment and what image format (GIF?, PNG? other?) would be easiest to handle on OS X, Windows, Linux?


EDIT My solution, based on GD, as recomended by Brian Agnew


use strict;
use warnings;
use GD;
my $BitMap = GD::Image->new(400,400);

my $white = $BitMap->colorAllocate(255,255,255);
my $black = $BitMap->colorAllocate(0,0,0);       

# Frame the BitMap
$BitMap->rectangle(0,0,399,399,$black);
# Transparent image, white background color
$BitMap->transparent($white);

# plot some, just to show it works #
for my $x (0..100) {
   for my $y (0 .. 100) {
      $BitMap->setPixel(250+100*sin($x)-$y,150+125*cos($x)+$y,$black); 
   }
}

# write png-format to file
open my $fh,">","test.png" or die "$!";
binmode $fh;
print $fh $BitMap->png;
close($fh);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:32:17+00:00Added an answer on May 12, 2026 at 6:32 am

    Have a look at the GD module (which interfaces to the GD library). It makes creating graphics pretty trivial and has a wide range of output formats, including PNG and GIF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a home project that really needs to be in Source Control. I
I'm working on a home project that involves comparing images to a database of
I'm still trying to decide whether my (home) project should use UTF-8 strings (implemented
I have to check some code and run it. I have the URL: svn+ssh://myuser@www.myclient.com/home/svn/project/trunk
Up till now I have been developing my personal and school projects at home
At home we have a proxy server. At work we don't. Firefox irritates in
At home, I use CTRL+SHIFT+B or F7 or whatever key sequence initiates the build
I use a home-grown system where the application updates itself from a web service.
While using Vim (at home and at work), I often find myself doing similar
My computer at home is set up to automatically download some stuff from RSS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.