1# Graphics Development 2 3## How do I obtain the DPI of a device? 4 5Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model) 6 7**Solution** 8 9Import the **@ohos.display** module and call the **getDefaultDisplaySync\(\)** API. 10 11**Example** 12 13``` 14import display from '@ohos.display'; 15let displayClass = null; 16try { 17 displayClass = display.getDefaultDisplaySync(); 18 console.info('Test densityDPI:' + JSON.stringify(displayClass.densityDPI)); 19} catch (exception) { 20 console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception)); 21} 22``` 23 24## How do I obtain the window width and height? 25 26Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model) 27 28**Solution** 29 30Import the **@ohos.window** module, obtain a **Window** object, and use **getWindowProperties\(\)** of the object to obtain the window properties. The **windowRect** field in the properties specifies the window width and height. 31 32**Example** 33 34``` 35import window from '@ohos.window'; 36let windowClass = null; 37try { 38 let promise = window.getLastWindow(this.context); 39 promise.then((data)=> { 40 // Obtain a Window object. 41 windowClass = data; 42 try { 43 // Obtain the window properties. 44 let properties = windowClass.getWindowProperties(); 45 let rect = properties.windowRect; 46 // rect.width: window width; rect.height: window height. 47 } catch (exception) { 48 console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(exception)); 49 } 50 console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data)); 51 }).catch((err)=>{ 52 console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err)); 53 });} catch (exception) { 54 console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception)); 55} 56``` 57 58## How do I perform Gaussian blurring on images? 59 60Applicable to: OpenHarmony 3.2 Beta5 (API version 9) 61 62**Solution** 63 64Import the **@ohos.multimedia.image** and **@ohos.effectKit** modules to process the image and add the blur effect. 65 66**Example** 67 68``` 69import image from "@ohos.multimedia.image"; 70import effectKit from "@ohos.effectKit"; 71 72 const color = new ArrayBuffer(96); 73 let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; 74 image.createPixelMap(color, opts).then((pixelMap) => { 75 let radius = 5; 76 let headFilter = effectKit.createEffect(pixelMap); 77 if (headFilter != null) { 78 headFilter.blur(radius); 79 } 80 }) 81``` 82 83**Reference** 84 85[blur](../reference/apis/js-apis-effectKit.md#blur) 86