Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Display partial image

by Anonymous Monk
on May 16, 2010 at 02:06 UTC ( [id://840183]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Is there a way - without using GD or ImageMagic - to display, say, the first 20 x 20 pixels of an image (jpg or gif or png) on a web page?

Hope it's not a stupid question :)

Thanks for reading!

Replies are listed 'Best First'.
Re: Display partial image
by ikegami (Patriarch) on May 16, 2010 at 05:51 UTC

    When you say ImageMagick (note the "k"), do you mean the library, the Perl bindings (Image::Magick in PerlMagick) or the command line tools? What's special about GD and ImageMagick that disqualifies them?

    Google finds a few tools.

      Not installed on the shared server :(

        So install one. It's not like you need special privileges.
Re: Display partial image
by afoken (Chancellor) on May 16, 2010 at 05:26 UTC

    Photoshop, Paint Shop Pro, Gimp, or one of the example painting applications that came with the OS or the office package. It does not make sense to download a 10 Mbytes 5000x5000 pixel image just to show a 20x20 pixel piece.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Display partial image
by Anonymous Monk on May 16, 2010 at 05:18 UTC
    You probably could do it using stupid css tricks ... google it
      <div style="width: 20px; height: 20px; overflow: hidden"> <img src="http://promote.pair.com/i/pair-banner-current.gif"> </div>

      Catch 1: The image must be in a block element.
      Catch 2: The whole image is still downloaded.

        Thanks, I tried a couple of CSS tricks but not "overflow: hidden".

        Still, I'm not getting the desired because the entire width of the image is displayed.

        I'm trying to display the image in parts to show a game's progress. Imagine the image is sliced into neat pieces of 10 px by 10px. So if the game is at stage 1, the first 10px x 10px is displayed, starting from x=0 and y=0. At stage 2, the next (moving rightward first), the next 10px by 10px is displayed to show the progress.

        Any more help or pointers will be appreciated :)

        But thats not google

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://840183]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found