get SubImages in JavaFX

we dont have a specific way to get subimages in JavaFx like we had in Api2D with ImageIO, however i paste this code here so you can transform an image strip into an array of images:


/*
suppose i have an image strip of 10 frames of 32x32 ( 320x32 ), then i want to separate all frames in individual images
getImage( 10, 32,32,"myStrip.png" );
*/
public static Image[] getImage( int frames, int w, int h,  String pathFile )
        {
           
            Image[] imgs =  new Image[ frames ];
            
            //img that contains all frames
            Image stripImg = new Image( pathFile );
            PixelReader pr =  stripImg.getPixelReader();
            PixelWriter pw = null;
            
            for( int i = 0; i < frames ; i++)
            {
            
                WritableImage wImg = new WritableImage( w, h );
            
                pw = wImg.getPixelWriter();
                
                for( int readY = 0 ; readY < h; readY++ )
                {
                
                    int ww = (w * i);
                    for( int readX = ww; readX < ww + w; readX++ )
                    {
                        //get pixel at X  & Y position
                        Color color = pr.getColor( readX, readY );
                        
                        //set pixel to writableimage through pixel writer
                        pw.setColor(readX - ww, readY, color);
                        
                    }//X
                    
                    
                }//Y
                
                
                //finally new image is stored
                imgs[ i ] = wImg;
            }//
            
            
            stripImg = null;
            pr = null;
            pw = null;
            
        return imgs;
        }//