def apply_profile_or_settings(self, image):
        """Apply a profile to the viewer.

        Parameters
        ----------
        image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage`
            Image object.

        This function is used to initialize the viewer when a new image
        is loaded.  Either the embedded profile settings or the default
        settings are applied as specified in the channel preferences.
        """
        profile = image.get('profile', None)
        keylist = []
        with self.suppress_redraw:
            if profile is not None:
                if self.t_['profile_use_transform'] and 'flip_x' in profile:
                    keylist.extend(['flip_x', 'flip_y', 'swap_xy'])

                if self.t_['profile_use_scale'] and 'scale' in profile:
                    keylist.extend(['scale'])

                if self.t_['profile_use_pan'] and 'pan' in profile:
                    keylist.extend(['pan'])

                if self.t_['profile_use_rotation'] and 'rot_deg' in profile:
                    keylist.extend(['rot_deg'])

                if self.t_['profile_use_cuts'] and 'cuts' in profile:
                    keylist.extend(['cuts'])

                if self.t_['profile_use_color_map'] and 'color_map' in profile:
                    keylist.extend(['color_algorithm', 'color_hashsize',
                                    'color_map', 'intensity_map',
                                    'color_array', 'shift_array'])

                self.apply_profile(profile, keylist=keylist)

            # proceed with initialization that is not in the profile
            # initialize transforms
            if self.t_['auto_orient'] and 'flip_x' not in keylist:
                self.logger.debug(
                    "auto orient (%s)" % (self.t_['auto_orient']))
                self.auto_orient()

            # initialize scale
            if self.t_['autozoom'] != 'off' and 'scale' not in keylist:
                self.logger.debug("auto zoom (%s)" % (self.t_['autozoom']))
                self.zoom_fit(no_reset=True)

            # initialize pan position
            # NOTE: False a possible value from historical use
            if (self.t_['autocenter'] not in ('off', False) and
                'pan' not in keylist):
                self.logger.debug(
                    "auto center (%s)" % (self.t_['autocenter']))
                self.center_image(no_reset=True)

            # initialize cuts
            if self.t_['autocuts'] != 'off' and 'cuts' not in keylist:
                self.logger.debug("auto cuts (%s)" % (self.t_['autocuts']))
                self.auto_levels()

            # save the profile in the image
            if self.use_image_profile:
                self.checkpoint_profile()

            self.redraw(whence=0)
Apply a profile to the viewer.

        Parameters
        ----------
        image : `~ginga.AstroImage.AstroImage` or `~ginga.RGBImage.RGBImage`
            Image object.

        This function is used to initialize the viewer when a new image
        is loaded.  Either the embedded profile settings or the default
        settings are applied as specified in the channel preferences.