PImage.height()

Description

Checks the height of the PImage object.

Syntax


image.height();

Parameters

none

Returns

int : the image’s height in pixels

Example

// this example looks for a file named "arduino.bmp"
//  on the SD card, and renders it to the screen
#include <SPI.h>
#include <SD.h>
#include <TFT.h>

#define cs   10
#define dc   9
#define rst  8
 
TFT screen = TFT(cs, dc, rst);

PImage logo;

void setup() {
  // initialize the screen
  screen.begin();
  // initialize the SD card
  SD.begin();
  // set the background the black
  screen.background(0, 0, 0);

  // load the image into the named instance of PImage 
  logo = screen.loadImage("arduino.bmp");

   if (!logo.isValid()) {
       Serial.println("error while loading arduino.bmp");
  }
}

void loop() {
  // randomly draw the image on screen
  int x = random(screen.width() - logo.width());
  int y = random(screen.height() - logo.height());
  screen.image(logo, x, y);
  delay(1500);
}

See also

image
loadImage( )
PImage.isValid( )
PImage.width( )


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.