The post shows a way to scale image which is displayed by vtkActor2D object.
We used vtkImageResize that performs sinc interpolation on images to change their sizes.
#include <vtkCamera.h>
#include <vtkImageActor.h>
#include <vtkImageCanvasSource2D.h>
#include <vtkImageData.h>
#include <vtkImageMapper3D.h>
#include <vtkImageReader2.h>
#include <vtkImageReader2Factory.h>
#include <vtkImageResize.h>
#include <vtkImageSincInterpolator.h>
#include <vtkInteractorStyleImage.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkPNGReader.h>
#include <vtkActor2D.h>
#include <vtkImageMapper.h>
#include <array>
int main(int argc, char* argv[])
{
int newSize[2] = { 400, 400 };
vtkNew<vtkPNGReader> reader;
reader->SetFileName( "/Users/weiyang/Desktop/test.png" );
reader->Update();
vtkNew<vtkImageSincInterpolator> interpolator;
vtkNew<vtkImageResize> resize;
resize->SetInputData( reader->GetOutput() );
resize->SetInterpolator(interpolator);
resize->SetOutputDimensions(newSize[0], newSize[1], 1);
resize->InterpolateOn();
resize->Update();
vtkNew<vtkImageMapper> mapper;
mapper->SetInputData( resize->GetOutput() );
mapper->Update();
mapper->GetInputAlgorithm()->UpdateInformation();
mapper->SetColorWindow( 256 );
mapper->SetColorLevel( 128 );
// Create an image actor to display the image
vtkNew<vtkActor2D> actor;
actor->SetMapper( mapper );
// Setup renderer
vtkNew<vtkRenderer> renderer;
renderer->AddActor2D( actor );
renderer->ResetCamera();
renderer->ResetCameraClippingRange();
// Setup render window
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
renderWindow->SetSize(1280, 1024);
// Setup render window interactor
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
vtkNew<vtkInteractorStyleImage> style;
renderWindowInteractor->SetInteractorStyle(style);
// Render and start interaction
renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindow->Render();
renderWindow->SetWindowName("ResizeImage"); //works after render
renderWindowInteractor->Initialize();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}